Quintiq file version 2.0
|
#parent: #root
|
Method InitConstraintsForTripDependentDemands (
|
CapacityPlanningSuboptimizer_CapacityPlanningAlgorithm program,
|
const LibOpt_Scope scope,
|
const constcontent ProductInTrips pitinrun,
|
Number threadnr
|
) const
|
{
|
Description: 'Initialize constraints for dependent demands for trips'
|
TextBody:
|
[*
|
// for each product in trip:
|
// dependent demand quantity = input factor * relative duration (should be always 1) * new supply quantity
|
constddqtyname := typeof( MPTripDependentDemandQtyConstraint );
|
|
scalefactor_tripdemandqty_constddqty := this.ScaleConstraintTerm( typeof( MPTripDemandQtyVariable ), constddqtyname );
|
scalefactor_tripnewsupply_constddqty := this.ScaleConstraintTerm( typeof( MPTripNewSupplyVariable ), constddqtyname );
|
|
scalefactor_rhs_constddqty := this.ScaleConstraintRHS( constddqtyname, 1.0 );
|
|
traverse( pitinrun,
|
Elements,
|
productintrip,
|
CapacityPlanningSuboptimizer::GetThreadNr( this.ThreadAParameter(), this.ThreadBParameter(), productintrip.PreThreadNr() ) = threadnr )
|
{
|
// constddqty constraint UoM: Input PISP
|
constddqty := program.TripDependentDemandQtyConstraints().New( productintrip );
|
constddqty.Sense( '=' );
|
constddqty.RHSValue( 0.0 * scalefactor_rhs_constddqty );
|
|
factor := 1.0;
|
dd := productintrip.DependentDemand();
|
|
if( not isnull( dd ) )
|
{
|
factor := guard( dd.ProcessInput().Factor(), 1 ) // can be changed to be > 1 or < 1. By default is 1
|
* dd.RelativeDuration();
|
}
|
else
|
{
|
laneleginput := select( productintrip, Trip.LaneLeg.LaneLegInput, input,
|
input.ProductInStockingPoint_MP().Product_MP() = productintrip.Product_MP() );
|
|
if( not isnull( laneleginput ) )
|
{
|
factor := laneleginput.Factor();
|
}
|
}
|
|
// Term: [Input PISP]
|
constddqty.NewTerm( -scalefactor_tripdemandqty_constddqty, program.TripDemandQtyVariables().Get( productintrip ) );
|
|
uomconversion := productintrip.DeparturePISPConversionFactor();
|
|
// Term: uomconversion * factor * TripNewSupply variable
|
// UoM: [Output PISP to Input PISP] * [-] * [Output PISP]
|
constddqty.NewTerm( uomconversion * factor * scalefactor_tripnewsupply_constddqty, program.TripNewSupplyVariables().Get( productintrip ) );
|
}
|
*]
|
InterfaceProperties { Accessibility: 'Module' }
|
}
|