1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
| Quintiq file version 2.0
| #parent: #root
| Method CreatePeriodTaskOperations (
| Period_MPs periods
| )
| {
| TextBody:
| [*
| starttime := OS::PrecisionCounter();
| operations := selectset( this, MacroPlan.Unit.OperationForOptimization, operation, true, true );
| debuginfo( 'all operations := ', counter( this, MacroPlan.Unit.Operation, op, true, true ), 'op for optimizer = ', operations.Size() );
| nrperiodtasks_at_start := counter( operations, Elements.PeriodTaskOperation, pto, true, true );
| debuginfo( 'Start period task creation. Nr pto at start = ', nrperiodtasks_at_start, 'periods = ', periods.Size(), 'operations = ', operations.Size(), 'mult:', periods.Size() * operations.Size() );
| notvalidnr := 0;
| traverse( periods, Elements, period )
| {
| traverse( operations, Elements, operation, operation.GetIsAvailableForOptimization() )
| {
| unit := operation.Unit();
| unitperiod := UnitPeriod::FindUnitPeriodTypeIndex( unit.ID(), period.Start(), period.End() );
| availcapacity := unitperiod.GetTotalAvailableCapacity();
| if ( availcapacity <= 0.0 )
| {
| traverse( unitperiod, PeriodTaskOperation, pto, pto.Quantity() = 0.0 )
| {
| pto.Delete();
| }
| }
| if( not unitperiod.IsPeriodFrozen()
| and not availcapacity <= 0.0
| and PeriodTaskOperation::GetIsValidPeriodTask( operation, period ) )
| {
| pto := PeriodTaskOperation::Create( operation, unitperiod, 0.0, false );
| if ( isnull( pto ) )
| {
| notvalidnr++;
| }
| }
| else
| {
| notvalidnr++;
| }
| }
| }
| nrperiodtasks_at_end := counter( operations, Elements.PeriodTaskOperation, pto, true, true );
|
| durationsecformethod := (OS::PrecisionCounter() - starttime) / OS::PrecisionCounterFrequency();
| debuginfo( 'Nr pto at end = ', nrperiodtasks_at_end );
| debuginfo( 'Created ', nrperiodtasks_at_end - nrperiodtasks_at_start, ' period task operations. Time for method = ', durationsecformethod, 'sec' );
| debuginfo( 'not valid count=', notvalidnr, 'Checksum#1: ', periods.Size() * operations.Size() - notvalidnr, 'Checksum#2', nrperiodtasks_at_end );
| *]
| InterfaceProperties { Accessibility: 'Module' }
| }
|
|