Quintiq file version 2.0
|
#parent: #root
|
Method FreezeVariablesForPostponedSalesDemands (
|
const CapacityPlanningSuboptimizer subopt,
|
CapacityPlanningSuboptimizer_CapacityPlanningAlgorithm program,
|
const LibOpt_Scope scope
|
) const
|
{
|
Description:
|
[*
|
Generic method to freeze delayed salesdemand MathematicalProgram variables
|
It can be used for LeafSalesDemandInPeriod, AggregatedSalesDemandInPeriod
|
*]
|
TextBody:
|
[*
|
varmpvariable := null( MPVariable );
|
|
if( this.CanBePostponed() and this.NeedsToBePlanned() )
|
{
|
nextpispip := this.AsPlanningBaseSalesDemandInPeriod().NextPlanningPISPIP();
|
// First set all variables to 0.0
|
for( i := 1;
|
i <= this.MaxPostponementPeriod() // within the maximum number of postponement periods
|
and not isnull( nextpispip ); // the next pispip exists
|
i++ )
|
{
|
if( scope.Contains( nextpispip.PISPIPInOptimizerRun() ) )
|
{
|
varmpvariable := this.GetDelayedSalesDemandQtyVariable( program, nextpispip.Period_MP() );
|
if( not isnull( varmpvariable ) )
|
{
|
subopt.FreezeVariableLowerUpperBound( varmpvariable, 0.0, 0.0 );
|
}
|
}
|
nextpispip := nextpispip.NextPlanningPISPIP();
|
}
|
|
// If there are already postponed sales demand instances, then freeze variables to optimizer fulfilled quantity
|
traverse( this, AllPostponedSalesDemand, psd )
|
{
|
period := guard( psd.AsSalesDemandInPeriodBase().Period_MP(), constnull( Period_MP ) );
|
if( not isnull( period ) )
|
{
|
varmpvariable := this.GetDelayedSalesDemandQtyVariable( program, nextpispip.Period_MP() );
|
if( not isnull( varmpvariable ) )
|
{
|
subopt.FreezeVariableLowerUpperBound( varmpvariable, psd.OptimizerFulfilledQuantity(), psd.OptimizerFulfilledQuantity() );
|
}
|
}
|
}
|
}
|
*]
|
InterfaceProperties { Accessibility: 'Module' }
|
}
|