Quintiq file version 2.0
|
#parent: #root
|
Method InitConstraintsForCampaignCalcDurationOfElementTypeEnd (
|
CapacityPlanningSuboptimizer_CapacityPlanningAlgorithm program,
|
const LibOpt_Scope scope
|
) const
|
{
|
TextBody:
|
[*
|
durationelementtypeend_constname := typeof( MPCalcDurationOfElementTypeEndConstraint );
|
scalefactor_DurationOfCampaignElementTypeEnd_const := this.ScaleConstraintTerm( typeof( MPDurationOfCampaignElementTypeEndVariable ), durationelementtypeend_constname );
|
scalefactor_IsLast_const := this.ScaleConstraintTerm( typeof( MPIsLastCampaignElementTypeVariable ), durationelementtypeend_constname );
|
|
traverse( scope.GetUnitPeriodInOptimizerRunConst(), Elements.OptCampaignUnitSubPeriod, ocusp )
|
{
|
traverse( ocusp, OptCampaignCombiElement.OptCampaignElementType, ocet )
|
{
|
constr := program.CalcDurationOfElementTypeEndConstraints().New( ocet, ocusp );
|
|
// Adding duration campaign element type end variable to constraint
|
vardurationstart := program.DurationOfCampaignElementTypeEndVariables().Get( ocet, ocusp );
|
constr.NewTerm( 1.0 * scalefactor_DurationOfCampaignElementTypeEnd_const, vardurationstart );
|
|
// subtracting BigM which is the min between campaign max duration and the period duration
|
bigm := minvalue( ifexpr( ocet.HasMaxDuration(), ocet.MaxDuration(), Duration::MaxDuration() ), ocusp.UnitPeriod().Duration() ).HoursAsReal();
|
islast := program.IsLastCampaignElementTypeVariables().Get( ocet, ocusp );
|
constr.NewTerm( - bigm * scalefactor_IsLast_const, islast );
|
}
|
}
|
*]
|
InterfaceProperties { Accessibility: 'Module' }
|
}
|