Quintiq file version 2.0
|
#parent: #root
|
Method DebugAssignGoalValue (
|
CapacityPlanningSuboptimizer_CapacityPlanningAlgorithm program,
|
AlgorithmRunLevel level,
|
LibOpt_Scope scope
|
)
|
{
|
Description: 'Assign goal value to attribute'
|
TextBody:
|
[*
|
// Storing of goal value to instances
|
|
level.Update( level.Start(), DateTime::ActualTime(), true, program.AbsoluteGap(), program.RelativeGap(), program.GoalValue(), program.Optimal() );
|
level.UpdateStatistics( program, this.IsAutoScalingEnabled() );
|
|
// Non-financial kpis
|
result := level.OptimizerNonFinancialKPIResult();
|
|
if( not isnull( result ) )
|
{
|
vartotalblending := program.TotalBlendingVariables().Get();
|
result.GoalValueBlending( -this.GetOptimalValue( vartotalblending ) );
|
|
vartotalcampaign := program.TotalCampaignVariables().Get();
|
result.GoalValueCampaign( -this.GetOptimalValue( vartotalcampaign ) );
|
|
vartotalfulfillment := program.TotalFulfillmentVariables().Get();
|
result.GoalValueFulfillment( this.GetOptimalValue( vartotalfulfillment ) );
|
|
varinventorymixbalancing := program.TotalInventoryMixBalancingVariables().Get();
|
result.GoalValueInventoryMixBalancing( -this.GetOptimalValue( varinventorymixbalancing ) );
|
|
vartotallotsize := program.TotalLotSizeVariables().Get();
|
result.GoalValueLotSize( -this.GetOptimalValue( vartotallotsize ) );
|
|
vartotalmaxinvlevel := program.TotalMaximumInventoryLevelVariables().Get();
|
result.GoalValueMaximumInventoryLevel( -this.GetOptimalValue( vartotalmaxinvlevel ) );
|
|
vartotalmininvlevel := program.TotalMinimumInventoryLevelVariables().Get();
|
result.GoalValueMinimumInventoryLevel( -this.GetOptimalValue( vartotalmininvlevel ) );
|
|
vartotalmaxsupply := program.TotalMaximumSupplyVariables().Get();
|
result.GoalValueMaximumSupply( -this.GetOptimalValue( vartotalmaxsupply ) );
|
|
var := program.TotalMinimumSupplyVariables().Get();
|
result.GoalValueMinimumSupply( -this.GetOptimalValue( var ) );
|
|
vartotalminunitcapacity := program.TotalMinimumUnitCapacityVariables().Get();
|
result.GoalValueMinimumUnitCapacity( -this.GetOptimalValue( vartotalminunitcapacity ) );
|
|
vartotalminunitsecondarycapacity := program.TotalMinimumUnitSecondaryCapacityVariables().Get();
|
result.GoalValueMinimumUnitSecondaryCapacity( -this.GetOptimalValue( vartotalminunitsecondarycapacity ) );
|
|
vartotalpostponementpenalty := program.TotalPostponementPenaltyVariables().Get();
|
result.GoalValuePostponementPenalty( -this.GetOptimalValue( vartotalpostponementpenalty ) );
|
|
vartotalprocessmaxqty := program.TotalProcessMaximumQuantityVariables().Get();
|
result.GoalValueProcessMaximumQuantity( -this.GetOptimalValue( vartotalprocessmaxqty ) );
|
|
vartotalsalesdemandpriority := program.TotalSalesDemandPriorityVariables().Get();
|
result.GoalValueSalesDemandPriority( this.GetOptimalValue( vartotalsalesdemandpriority ) );
|
|
vartotalfulfillmenttarget := program.TotalFulfillmentTargetVariables().Get();
|
result.GoalValueFulfillmentTarget( this.GetOptimalValue( vartotalfulfillmenttarget ) );
|
|
vartotalservicelevel := program.TotalServiceLevelVariables().Get();
|
result.GoalValueServiceLevel( this.GetOptimalValue( vartotalservicelevel ) );
|
|
vartotalstockingcapacity := program.TotalStockingPointCapacityVariables().Get();
|
result.GoalValueStockingPointCapacity( -this.GetOptimalValue( vartotalstockingcapacity ) );
|
|
vartotalslack := program.TotalSlackVariables().Get();
|
result.GoalValueSlack( -this.GetOptimalValue( vartotalslack ) );
|
|
vartotalsupplytarget := program.TotalSupplyTargetVariables().Get();
|
result.GoalValueSupplyTarget( -this.GetOptimalValue( vartotalsupplytarget ) );
|
|
vartotaltargetinvlevel := program.TotalTargetInvLevelVariables().Get();
|
result.GoalValueTargetInventoryLevel( -this.GetOptimalValue( vartotaltargetinvlevel ) );
|
|
vartotalunitcapacity := program.TotalUnitCapacityVariables().Get();
|
result.GoalValueUnitCapacity( -this.GetOptimalValue( vartotalunitcapacity ) );
|
|
vartotalunitsecondarycapacity := program.TotalUnitSecondaryCapacityVariables().Get();
|
result.GoalValueUnitSecondaryCapacity( - this.GetOptimalValue( vartotalunitsecondarycapacity ) );
|
|
vartotalcapacitysmoothingslack := program.TotalCapacitySmoothingSlackVariables().Get();
|
result.GoalValueCapacitySmoothingSlack( -this.GetOptimalValue( vartotalcapacitysmoothingslack ) );
|
|
vartotalexpired := program.TotalExpiredQtyVariables().Get();
|
result.GoalValueTotalExpiredQty( -this.GetOptimalValue( vartotalexpired ) );
|
|
vartotalco2emission := program.TotalCO2EmissionVariables().Get();
|
result.GoalValueCO2Emission( -this.GetOptimalValue( vartotalco2emission ) );
|
|
vartotalshiftpatternchangespenalty := program.TotalShiftPatternChangesPenaltyVariables().Get();
|
result.GoalValueShiftPatternChangesPenalty( -this.GetOptimalValue( vartotalshiftpatternchangespenalty ) );
|
}
|
|
// Account kpis
|
traverse( scope.GetAccountsInOptimizerRun(), Elements, account )
|
{
|
accountresult := select( level, OptimizerAccountKPIResult, r, r.AccountName() = account.Name() );
|
|
if( not isnull( accountresult ) )
|
{
|
traverse( account, AccountAssignment.AccountCostDriver, driver )
|
{
|
if( driver.Name() = Translations::MP_AccountAssignmentCostDriverFixed() ) // fixed
|
{
|
// we don't need fixed cost in the optimizer.
|
}
|
else if ( driver.Name() = Translations::MP_AccountAssignmentCostDriverInventorySupply() )
|
{
|
// cost driver inventory supply not applicable in optimizer // inventory supply
|
}
|
else if( driver.Name() = Translations::MP_AccountAssignmentCostDriverStaffing() ) // staffing
|
{
|
var := program.DriverStaffingVariables().Get( account, driver );
|
value := this.GetOptimalValue( var );
|
accountresult.GoalValueStaffing( -value );
|
}
|
else if( driver.Name() = Translations::MP_AccountAssignmentCostDriverInventoryValue() ) // inventory value
|
{
|
var := program.DriverInventoryValueVariables().Get( account, driver );
|
value := this.GetOptimalValue( var );
|
accountresult.GoalValueInventoryValue( value );
|
}
|
else if( driver.Name() = Translations::MP_AccountAssignmentCostDriverInventoryHolding() ) // inventory holding
|
{
|
var := program.DriverInventoryHoldingVariables().Get( account, driver );
|
value := this.GetOptimalValue( var );
|
accountresult.GoalValueInventoryHolding( -value );
|
}
|
else if( driver.Name() = Translations::MP_AccountAssignmentCostDriverNrOfUnits() ) // nr of units
|
{
|
var := program.DriverNrOfUnitsVariables().Get( account, driver );
|
value := this.GetOptimalValue( var );
|
accountresult.GoalValueNrOfUnits( -value );
|
}
|
else if( driver.Name() = Translations::MP_AccountAssignmentCostDriverSales() ) // sales
|
{
|
var := program.DriverSalesVariables().Get( account, driver );
|
value := this.GetOptimalValue( var );
|
accountresult.GoalValueSales( value );
|
}
|
else if( driver.Name() = Translations::MP_AccountAssignmentCostDriverTime() ) // time
|
{
|
var := program.DriverTimeVariables().Get( account, driver );
|
value := this.GetOptimalValue( var );
|
accountresult.GoalValueTime( -value );
|
}
|
else if( driver.Name() = Translations::MP_AccountAssignmentCostDriverVolume() ) // volume
|
{
|
var := program.DriverVolumeVariables().Get( account, driver );
|
value := this.GetOptimalValue( var );
|
accountresult.GoalValueVolume( -value );
|
}
|
else if( driver.Name() = Translations::MP_AccountAssignmentCostDriverLot() ) // Lot
|
{
|
var := program.DriverLotVariables().Get( account, driver );
|
value := this.GetOptimalValue( var );
|
accountresult.GoalValueLot( -value );
|
}
|
else if( driver.Name() = Translations::MP_AccountAssignmentCostDriverChangeover() ) // Changeover
|
{
|
var := program.DriverChangeoverVariables().Get( account, driver );
|
value := this.GetOptimalValue( var );
|
accountresult.GoalValueChangeOver( -value );
|
}
|
else if ( driver.Name() = Translations::MP_AccountAssignmentCostDriverOneTime() ) // One-time
|
{
|
var := program.DriverOneTimeVariables().Get( account, driver );
|
value := this.GetOptimalValue( var );
|
accountresult.GoalValueOneTimeCost( -value );
|
}
|
else
|
{
|
info( '>>> Missing goal value assignment for account ', account.Name(), ' driver name:', driver.Name() );
|
}
|
}
|
}
|
}
|
*]
|
InterfaceProperties { Accessibility: 'Module' }
|
}
|