yanweiyuan3
2023-08-09 588bc7829387dfc761cc25f06f77d4c81818bd10
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
Quintiq file version 2.0
#parent: #root
MethodOverride UpdateRHSForPeriodTasksNotInScope (
  MPConstraint minconst,
  MPConstraint maxconst,
  const RunContextForCapacityPlanning runcontext,
  const LibOpt_Scope scope,
  const CapacityPlanningSuboptimizer subopt,
  Real scalefactor_rhs_minconst,
  Real scalefactor_rhs_maxconst
) const
{
  TextBody:
  [*
    //Update the RHS based on the trips outside the optimizer horizon
    traverse( this, PeriodTask_MP.astype( PeriodTaskLaneLeg ), ptll )
    {
      traverse( ptll, Trip.ProductInTrip, pit,
                not scope.Contains(  pit.ProductInTripInOptimizerRun() )
                and ( pit.HasRegularProductForOptimizer() or pit.Product_MP().GetIsInOptimizerRun( runcontext.IsPostProcessing() ) ) )
      {
        // The quantity of this product in trip that is outside the horizon
        fixedquantity := pit.QuantityInProcessUOM();
        newrhsminconst := subopt.GetConstraintRHS( minconst, scalefactor_rhs_minconst ) - fixedquantity;
        minconst.RHSValue( newrhsminconst * scalefactor_rhs_minconst );
      
        newrhsmaxconst := subopt.GetConstraintRHS( maxconst, scalefactor_rhs_maxconst ) - fixedquantity;
        maxconst.RHSValue( newrhsmaxconst * scalefactor_rhs_minconst );
      }
    }
    
    traverse( this, ChildOfUnitDimension, childunitperiod )
    {
      childunitperiod.UpdateRHSForPeriodTasksNotInScope( minconst, maxconst, runcontext, scope, subopt, scalefactor_rhs_minconst, scalefactor_rhs_maxconst );
    }
  *]
}