Quintiq file version 2.0
|
#parent: #root
|
Method SetWeightsAndParams (
|
Boolean issmartplan,
|
StrategyMacroPlan strategymacroplan,
|
LibOBT_RunTaskSetting setting
|
) as AlgorithmRun
|
{
|
Description: 'Set active weights and optimizer parameters'
|
TextBody:
|
[*
|
// Set the strategy
|
algorithmrun := this.SynchronizeAlgorithmRun( issmartplan );
|
algorithmrun.UpdateOptimizerSetting( strategymacroplan );
|
|
// Set active value for non financial kpi
|
traverse( strategymacroplan, KPIWeightMacroPlan, kpiweight, not kpiweight.KPIIsAccount() )
|
{
|
name := kpiweight.KPIName();
|
|
if( name = Translations::MP_GlobalParameters_KPIBlendingName() )
|
{
|
algorithmrun.BlendingWeight( kpiweight.Weight() );
|
algorithmrun.BlendingLevel( kpiweight.Level() );
|
}
|
else if( name = Translations::MP_GlobalParameters_KPICampaignName() )
|
{
|
algorithmrun.CampaignWeight( kpiweight.Weight() );
|
algorithmrun.CampaignLevel( kpiweight.Level() );
|
}
|
else if( name = Translations::MP_GlobalParameters_KPIFulfillmentName() )
|
{
|
algorithmrun.FulfillmentWeight( kpiweight.Weight() );
|
algorithmrun.FulfillmentLevel( kpiweight.Level() );
|
}
|
else if( name = Translations::MP_GlobalParameters_KPILotSizeName() )
|
{
|
algorithmrun.LotSizeWeight( kpiweight.Weight() );
|
algorithmrun.LotSizeLevel( kpiweight.Level() );
|
}
|
else if( name = Translations::MP_GlobalParameters_KPIInventoryMixBalancing() )
|
{
|
algorithmrun.InventoryMixBalancingWeight( kpiweight.Weight() );
|
algorithmrun.InventoryMixBalancingLevel( kpiweight.Level() );
|
}
|
else if( name = Translations::MP_GlobalParameters_KPIMaximumInventoryLevelName() )
|
{
|
algorithmrun.MaximumInventoryLevelWeight( kpiweight.Weight() );
|
algorithmrun.MaximumInventoryLevel( kpiweight.Level() );
|
}
|
else if( name = Translations::MP_GlobalParameters_KPIMinimumInventoryLevelName() )
|
{
|
algorithmrun.MinimumInventoryLevelWeight( kpiweight.Weight() );
|
algorithmrun.MinimumInventoryLevel( kpiweight.Level() );
|
}
|
else if( name = Translations::MP_GlobalParameters_KPIMaximumSupplyName() )
|
{
|
algorithmrun.MaximumSupplyWeight( kpiweight.Weight() );
|
algorithmrun.MaximumSupplyLevel( kpiweight.Level() );
|
}
|
else if( name = Translations::MP_GlobalParameters_KPIMinimumSupplyName() )
|
{
|
algorithmrun.MinimumSupplyWeight( kpiweight.Weight() );
|
algorithmrun.MinimumSupplyLevel( kpiweight.Level() );
|
}
|
else if( name = Translations::MP_GlobalParameters_KPIMinimumUnitCapacityName() )
|
{
|
algorithmrun.MinimumUnitCapacityWeight( kpiweight.Weight() );
|
algorithmrun.MinimumUnitCapacityLevel( kpiweight.Level() );
|
}
|
else if( name = Translations::MP_GlobalParameters_KPIPostponementPenaltyName() )
|
{
|
algorithmrun.PostponementPenaltyWeight( kpiweight.Weight() );
|
algorithmrun.PostponementPenaltyLevel( kpiweight.Level() );
|
}
|
else if( name = Translations::MP_GlobalParameters_KPIProcessMaximumQuantity() )
|
{
|
algorithmrun.ProcessMaximumQuantityWeight( kpiweight.Weight() );
|
algorithmrun.ProcessMaximumQuantityLevel( kpiweight.Level() );
|
}
|
else if( name = Translations::MP_GlobalParameters_KPIProcessMinimumQuantity() )
|
{
|
algorithmrun.ProcessMinimumQuantityWeight( kpiweight.Weight() );
|
algorithmrun.ProcessMinimumQuantityLevel( kpiweight.Level() );
|
}
|
else if( name = Translations::MP_GlobalParameters_KPISalesDemandPriorityName() )
|
{
|
algorithmrun.SalesDemandPriorityWeight( kpiweight.Weight() );
|
algorithmrun.SalesDemandPriorityLevel( kpiweight.Level() );
|
}
|
else if( name = Translations::MP_GlobalParameters_KPIFulfillmentTargetName() )
|
{
|
algorithmrun.FulfillmentTargetWeight( kpiweight.Weight() );
|
algorithmrun.FulfillmentTargetLevel( kpiweight.Level() );
|
}
|
else if( name = Translations::MP_GlobalParameters_KPIServiceLevelName() )
|
{
|
algorithmrun.ServiceLevelWeight( kpiweight.Weight() );
|
algorithmrun.ServiceLevelLevel( kpiweight.Level() );
|
}
|
else if( name = Translations::MP_GlobalParameters_KPIStockingPointCapacityName() )
|
{
|
algorithmrun.StockingPointCapacityWeight( kpiweight.Weight() );
|
algorithmrun.StockingPointCapacityLevel( kpiweight.Level() );
|
}
|
else if( name = Translations::MP_GlobalParameters_KPISupplyTargetName() )
|
{
|
algorithmrun.SupplyTargetWeight( kpiweight.Weight() );
|
algorithmrun.SupplyTargetLevel( kpiweight.Level() );
|
}
|
else if( name = Translations::MP_GlobalParameters_KPISafetyStock() )
|
{
|
algorithmrun.TargetInventoryLevelWeight( kpiweight.Weight() );
|
algorithmrun.TargetInventoryLevel( kpiweight.Level() );
|
}
|
else if( name = Translations::MP_GlobalParameters_KPIUnitCapacityName() )
|
{
|
algorithmrun.UnitCapacityWeight( kpiweight.Weight() );
|
algorithmrun.UnitCapacityLevel( kpiweight.Level() );
|
}
|
else if( name = Translations::MP_GlobalParameters_KPICapacitySmoothing() )
|
{
|
algorithmrun.CapacitySmoothingWeight( kpiweight.Weight() );
|
algorithmrun.CapacitySmoothingLevel( kpiweight.Level() );
|
}
|
else if( name = Translations::MP_GlobalParameters_KPITotalExpiredQuantity() )
|
{
|
algorithmrun.ExpiredQtyWeight( kpiweight.Weight() );
|
algorithmrun.ExpiredQtyLevel( kpiweight.Level() );
|
}
|
else if( name = Translations::MP_GlobalParameters_KPICO2Emission() )
|
{
|
algorithmrun.CO2EmissionWeight( kpiweight.Weight() );
|
algorithmrun.CO2EmissionLevel( kpiweight.Level() );
|
}
|
else if( name = Translations::MP_GlobalParameters_KPIShiftPatternChangesPenalty() )
|
{
|
algorithmrun.ShiftPatternChangesPenaltyWeight( kpiweight.Weight() );
|
algorithmrun.ShiftPatternChangesPenaltyLevel( kpiweight.Level() );
|
}
|
}
|
|
// Scaling factors used for the run
|
algorithmrun.MassScalingFactor( strategymacroplan.MassScalingFactor() );
|
algorithmrun.MonetaryScalingFactor( strategymacroplan.MonetaryScalingFactor() );
|
algorithmrun.TimeScalingFactor( strategymacroplan.TimeScalingFactor() );
|
algorithmrun.TimeAccountScalingFactor( strategymacroplan.TimeAccountScalingFactor() );
|
algorithmrun.InventoryHoldingScalingFactor( strategymacroplan.InventoryHoldingScalingFactor() );
|
|
hascostdriverlotactiveaccount := false;
|
hasonetimecostdriveractive := false;
|
// Account kpis
|
traverse( strategymacroplan, KPIWeightMacroPlan, kpiweight, kpiweight.KPIIsAccount() )
|
{
|
account := select( this, MacroPlan.Account_MP, a, a.Name() = kpiweight.KPIName() );
|
|
if( not isnull( account ) )
|
{
|
account.UpdateOptimizerStrategy( kpiweight.Level(), kpiweight.Weight() );
|
|
hascostdriverlotactiveaccount := hascostdriverlotactiveaccount
|
or ( account.IsCostDriverLot()
|
and account.Weight() > 0
|
and account.Level() > 0
|
and account.IsUsedByOptimizer() );
|
hasonetimecostdriveractive := hasonetimecostdriveractive
|
or ( account.IsCostDriverOneTimeCost()
|
and account.Weight() > 0
|
and account.Level() > 0
|
and account.IsUsedByOptimizer() );
|
}
|
}
|
|
algorithmrun.UseLotCost( hascostdriverlotactiveaccount );
|
algorithmrun.UseOneTimeCost( hasonetimecostdriveractive );
|
|
if ( not strategymacroplan.UseMetaOptimizer() ) // for the meta optimizer the update will happen at the start of each focus level
|
{
|
this.UpdateGoalScaling( strategymacroplan, null( StrategyLevelMacroPlan ) ); // not providing strategy level macroplan, so non level specific factors are used ( also for hidden level of meta)
|
}
|
|
AlgorithmRunLevel::CreateAlgorithmRunLevelsAndKPIResults( algorithmrun, strategymacroplan, setting );
|
|
// Set the time and status
|
this.MacroPlan().LastOptimizerRun( DateTime::ActualTime() );
|
|
return algorithmrun;
|
*]
|
InterfaceProperties { Accessibility: 'Module' }
|
}
|