Quintiq file version 2.0
|
#parent: #root
|
Method InitConstraintsForOperationDependentDemands_Add (
|
CapacityPlanningSuboptimizer_CapacityPlanningAlgorithm program,
|
const RunContextForCapacityPlanning runcontext,
|
const LibOpt_Scope scope,
|
const OperationInput input,
|
const Period_MP period,
|
constcontent Period_MPs pispipperiods,
|
Boolean usingproportialleadtimelogic,
|
Real scalefactor_partialoperationdemandqty_constddpartial,
|
Real scaling,
|
Real coef_relduration_partialcase
|
) const
|
{
|
Description: 'Initialize constraints for dependent demands for operations which does not have an input group'
|
TextBody:
|
[*
|
// dependent demand quantity of input products = pt quantity * factor * relative duration.
|
// relative duration = 1 if there is no pre-processing.
|
// 0 < relative duration <= 1 if there is pre-processing.
|
|
//input: operation
|
// period = pt period
|
|
operation := input.Operation();
|
|
// The dependent demand has to takes relative duration of the pispip period (the bucket it belongs) and the pt period into account.
|
|
// To get the period of period tasks from dependent demands, it can be treated as "new supplies" of dependent demands.
|
// Please read the optimizer solution design for more information.
|
endofpt := period.End(); // dummy value - not used if not proportional
|
startofpt := period.Start(); // dummy value - not used if not proportional
|
if ( usingproportialleadtimelogic )
|
{
|
endofpt := Process_MP::GetDependentDemandEndOperationLeadTime( period, operation.LeadTime() );
|
startofpt := Process_MP::GetOperationStart( period, endofpt );
|
}
|
|
traverse( pispipperiods, Elements, ptperiod )
|
{
|
// constddpartial constraint UoM: input PISP
|
constddpartial := program.PartialOperationDependentDemandQtyConstraints().New( input, ptperiod, period );
|
constddpartial.Sense( '=' );
|
// using default 0.0 RHS for constddpartial
|
// Term UoM: input PISP
|
constddpartial.NewTerm( -1.0 * scalefactor_partialoperationdemandqty_constddpartial * scaling, program.PartialOperationDemandQtyVariables().Get( input, ptperiod, period ) );
|
|
// If the leadtime logic is not proportional, then the relative duration is 1
|
// Otherwise, calculate the relative duration
|
relativeduration := 1.0;
|
if( usingproportialleadtimelogic )
|
{
|
start := Process_MP::GetNewSupplyStart( startofpt, ptperiod );
|
end := Process_MP::GetNewSupplyEnd( endofpt, ptperiod );
|
relativeduration := Process_MP::GetRelativeDuration( start, end, period);
|
}
|
|
// Term: dependentdemandqty * PTQty variable
|
// UoM: [Unit to input PISP] * [Unit]
|
constddpartial.NewTerm( coef_relduration_partialcase * relativeduration, // relative duration applied multiplicatively in order to equal PeriodTaskOperation::GetDependentDemandQuantity( 1.0, input, relativeduration ).
|
program.PTQtyVariables().Get( operation, period ) );
|
} //end traverse
|
*]
|
InterfaceProperties { Accessibility: 'Module' }
|
}
|