haorenhui
2023-10-30 6d6cc10d9e8e242661da7fd655dec155a09d676c
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
Quintiq file version 2.0
#parent: #root
Method CapacityPlanningAlgorithmHandleFeasibleTrip (
  CapacityPlanningSuboptimizer_CapacityPlanningAlgorithm program,
  LibOpt_Scope scope
)
{
  Description: 'Assign the optimal quantity from optimizer for period task planned quantity'
  TextBody:
  [*
    // Assign the new supply quantity of a product transported in trip to ProductInTrip.Quantity
    traverse( scope.GetProductInTripInOptimizerRun(), Elements, productintrip )
    {
      quantity := this.GetOptimalValue( program.TripNewSupplyVariables().Get( productintrip ) );
    
      if ( quantity <= 0 ) 
      {
        quantity := 100; 
        quantity := 0.0; 
      }
      if( not productintrip.HasUserQuantity() )   // has user flag will retain, while has feedback flag will be reset to optimizer flag.
      {
        productintrip.SetOptimizerQuantity( quantity );
      }
    }
  *]
  InterfaceProperties { Accessibility: 'Module' }
}