Quintiq file version 2.0
|
#parent: #root
|
MethodOverride CreateRun () as LibOpt_Run
|
{
|
TextBody:
|
[*
|
mp := this.Optimization().astype( Optimization ).MacroPlan();
|
settings := this.ActiveSettings().astype( OptimizerMetaSettings );
|
puzzle := select( mp, OptimizerPuzzle, puzzle, true, puzzle.Name() = settings.PuzzleName() );
|
|
periodstart := minselect( mp, Period_MP, p, not p.IsHistorical(), p.StartDate() );
|
periodend := mp.LastPlanningPeriod();
|
|
this.Optimization().astype( Optimization ).GetPeriodsForOTS( periodstart, periodend, settings );
|
|
issmartplan := false;
|
issmartplanforperiodtask := false;
|
hastotalsupplyuser := false;
|
totalsupplyuser := 0.0;
|
smartplanpispips := null( ProductInStockingPointInPeriodPlanningLeafs );
|
isupstreamsmartplan := false;
|
ismiddleoutsmartplan := false;
|
isonlyplanonestepupstream := false;
|
ispostprocessing := false;
|
isforcenoautoscaling := true;
|
isoverridemanualplanning := settings.OverrideManualPlanning();
|
isinventoryoptimizationrun := false;
|
isusingselectedunits := false;
|
units := null( Units );
|
process := null( Process_MP );
|
|
strategy := null( Strategy );
|
if ( isnull( mp.StrategyMacroPlan() ) ) // use exising strategy if exists (for regular optimizer run this will have been set,
|
{ // for OTS we have a workaround via method LibOpt_BT_RunSequenceElement.MyMethodTemp that copies the strategy
|
// only thing we support at the moment for 'play' button from libopt optimizer from is to repeat for strategy that has been run already
|
// for updating target KPIs for LibOpt_BT benchmark application we create the following bogus strategy
|
strategy := construct( Strategy, Name := 'dummy workaround' );
|
strategy.StrategyLevel( relnew, Level := 0, StrategyName := strategy.Name(), SolverSettingGroupName := 'Default' );
|
}
|
|
// fetch legacy algorithmrun object (still used for benchmark runs LibOBT)
|
algrun := mp.InitializeOptimizerRun( issmartplan,
|
issmartplanforperiodtask,
|
hastotalsupplyuser,
|
totalsupplyuser,
|
smartplanpispips,
|
isupstreamsmartplan,
|
ismiddleoutsmartplan,
|
isonlyplanonestepupstream,
|
ispostprocessing,
|
isforcenoautoscaling,
|
strategy,
|
isoverridemanualplanning,
|
periodstart,
|
periodend,
|
isinventoryoptimizationrun,
|
isusingselectedunits,
|
units,
|
process,
|
puzzle );
|
|
run := super.CreateRun();
|
run :=this.CreateRunWithContexts( algrun, run, units, periodstart, periodend );
|
|
rcm := select( run, RunContext.astype( RunContextMeta ), rc, true, true );
|
|
// put OTS settings onto runcontext meta
|
rcm.OptionAutoTuneNeighborhoodSize( settings.OptionAutoTuneNeighborhoodSize() );
|
rcm.OptionMaxNumberOfPISPIPSForNeighborhood( settings.OptionMaxNumberOfPISPIPSForNeighborhood() );
|
rcm.OptionMaxNumberOfPISPIPSForNeighborhoodOriginal( rcm.OptionMaxNumberOfPISPIPSForNeighborhood() );
|
rcm.OptionRollbackAlwaysAccept( settings.OptionRollbackAlwaysAccept() );
|
rcm.OptionStopOnInfeasible( settings.OptionStopOnInfeasible());
|
|
return run;
|
*]
|
}
|