| Quintiq file version 2.0 | 
| #parent: #root | 
| MethodOverride InitConstraintsForUnitPeriodCapacities ( | 
|   CapacityPlanningSuboptimizer_CapacityPlanningAlgorithm program, | 
|   Boolean enableminconst, | 
|   Real totalmincapacity, | 
|   Real totalmaxcapacity, | 
|   const RunContextForCapacityPlanning runcontext, | 
|   const LibOpt_Scope scope, | 
|   const CapacityPlanningSuboptimizer subopt | 
| ) const | 
| { | 
|   TextBody: | 
|   [* | 
|     algorithm := subopt;  | 
|      | 
|     // defining minimum capacities for unit, Sum of PT Qty + not met >= UP.MinCapacity | 
|     // minconstup constraint UoM: Unit | 
|     minconstup := null( MPConstraint ); | 
|      | 
|     if( this.Unit().HasCapacityTypeTransportTime() )  | 
|     { | 
|       minconstup := program.MinUnitCapacityTimeConstraints().New( this ); | 
|     } | 
|     else | 
|     { | 
|       minconstup := program.MinUnitCapacityQtyConstraints().New( this ); | 
|     } | 
|      | 
|     minconstup.Sense( '>=' ); | 
|      | 
|     // RHS UoM: Unit | 
|     minconstup.RHSValue( algorithm.ScaleConstraintRHS( typeofexpression( minconstup ), totalmincapacity ) ); | 
|     // Term UoM: Unit | 
|     var := this.GetCapacityNotMetVariable( program );  | 
|     minconstup.NewTerm( 1.0 * algorithm.ScaleConstraintTerm( typeofexpression( var ), typeofexpression( minconstup ) ) | 
|                         , var ); | 
|     minconstup.Enabled( enableminconst ) | 
|      | 
|     // defining maximum capacities for unit, Sum of PT Qty <= UP.AvailableCapacity | 
|     // maxconstup constraint UoM: Unit | 
|     maxconstup := null( MPConstraint ); | 
|     if( this.Unit().HasCapacityTypeTransportTime() ) | 
|     { | 
|       maxconstup := program.MaxUnitCapacityTimeConstraints().New( this ); | 
|     } | 
|     else | 
|     { | 
|       maxconstup := program.MaxUnitCapacityQtyConstraints().New( this ); | 
|     } | 
|      | 
|     maxconstup.Sense( '<=' ); | 
|     // RHS UoM: Unit | 
|     maxconstup.RHSValue( algorithm.ScaleConstraintRHS( typeofexpression( maxconstup ), totalmaxcapacity ) ); | 
|     maxconstup.Enabled( not this.IsPlannedInfinite() ); | 
|      | 
|     this.InitConstraintsForCapacityUsage( program, minconstup, maxconstup, runcontext, scope, subopt ); | 
|   *] | 
| } |