Quintiq file version 2.0
|
#parent: #root
|
MethodOverride InitVariablesForPostponedSalesDemands (
|
const CapacityPlanningSuboptimizer subopt,
|
CapacityPlanningSuboptimizer_CapacityPlanningAlgorithm program,
|
const LibOpt_Scope scope,
|
Number optminpostponementperiod,
|
Boolean shelflifevaronly
|
) const
|
{
|
TextBody:
|
[*
|
lsdip := this;
|
|
if( lsdip.CanBePostponed() and lsdip.NeedsToBePlanned() )
|
{
|
nextpispip := lsdip.AsPlanningBaseSalesDemandInPeriod().NextPlanningPISPIP();
|
|
for( i := 2;
|
i <= optminpostponementperiod
|
and not isnull( nextpispip );
|
i++
|
)
|
{
|
nextpispip := nextpispip.NextPlanningPISPIP();
|
}
|
|
for( i := optminpostponementperiod;
|
i <= lsdip.MaxPostponementPeriod() // within the maximum number of postponement periods
|
and not isnull( nextpispip ); // the next pispip exists
|
i++ )
|
{
|
if( scope.Contains( nextpispip.PISPIPInOptimizerRun() ) )
|
{
|
// DelayedSalesDemandQty variable UoM: PISP
|
// look if variable is already defined, because we also init variable for the extra shelf life pispips prior to horizon
|
var := ifexpr( shelflifevaronly, program.DelayedSalesDemandQtyVariables().Find( lsdip, nextpispip.Period_MP() ), null( MPVariable ) );
|
if ( isnull( var ) )
|
{
|
var := program.DelayedSalesDemandQtyVariables().New( lsdip, nextpispip.Period_MP() );
|
upperbound := maxvalue( 0.0, lsdip.GetQuantityForOptimizer( scope ) );
|
subopt.FreezeVariableUpperBound( var, upperbound );
|
}
|
|
if ( nextpispip.ProductInStockingPoint_MP().IsOptShelfLife() )
|
{
|
traverse( nextpispip, ProductInStockingPoint_MP.IncomingShelfLifeDay, islday )
|
{
|
// look if variable is already defined, because we also init variable for the extra shelf life pispips prior to horizon
|
dvar := program.DelayedSalesDemandShelfLifeQtyVariables().Find( lsdip, nextpispip.Period_MP(), islday );
|
if ( isnull( dvar ) )
|
{
|
program.DelayedSalesDemandShelfLifeQtyVariables().New( lsdip, nextpispip.Period_MP(), islday );
|
}
|
}
|
}
|
}
|
nextpispip := nextpispip.NextPlanningPISPIP();
|
}
|
}
|
*]
|
}
|