Quintiq file version 2.0
|
#parent: #root
|
Method InitConstraintsForCampaignMinQtyWithin (
|
CapacityPlanningSuboptimizer_CapacityPlanningAlgorithm program,
|
const LibOpt_Scope scope
|
) const
|
{
|
TextBody:
|
[*
|
minqtywithin_constname := typeof( MPMinCampaignElementTypeQtyWithinConstraint );
|
scalefactor_PTQtyWithin_const := this.ScaleConstraintTerm( typeof( MPPTQtyInCampaignElementTypeMidVariable ), minqtywithin_constname );
|
scalefactor_NrOfElementsWithin_const := this.ScaleConstraintTerm( typeof( MPNrOfCampaignElementWithinUnitSubPeriodVariable ), minqtywithin_constname );
|
scalefactor_MinElementTypeQtyUnderWithin_const := this.ScaleConstraintTerm( typeof( MPMinCampaignElementTypeQtyUnderWithinVariable ), minqtywithin_constname );
|
|
traverse( scope.GetUnitPeriodInOptimizerRunConst(), Elements.OptCampaignUnitSubPeriod, ocusp )
|
{
|
//Only do this for campaign / transitions that have a MinQuantity (and thus, MinQuantity is greater than 0 )
|
traverse( ocusp, OptCampaignCombiElement.OptCampaignElementType, ocet, ocet.MinQuantity() > 0.0 )
|
{
|
constr := program.MinCampaignElementTypeQtyWithinConstraints().New( ocet, ocusp );
|
constr.RHSValue( 0.0 );
|
|
traverse( ocet, OptCampaignOperationInElementType, oiet )
|
{
|
ptqyvar := program.PTQtyInCampaignElementTypeMidVariables().Get( oiet, ocusp );
|
constr.NewTerm( 1.0 * scalefactor_PTQtyWithin_const, ptqyvar );
|
}
|
|
//If this is a transition, we want these constraints to be hard ones
|
if( not ocet.istype( OptCampaignTransitionType ) )
|
{
|
constr.NewTerm( 1.0 * scalefactor_MinElementTypeQtyUnderWithin_const, program.MinCampaignElementTypeQtyUnderWithinVariables().Get( ocet, ocusp ) );
|
}
|
constr.NewTerm( -ocet.MinQuantity() * scalefactor_NrOfElementsWithin_const, program.NrOfCampaignElementWithinUnitSubPeriodVariables().Get( ocet, ocusp ) );
|
}
|
}
|
*]
|
}
|