Quintiq file version 2.0
|
#parent: #root
|
Method UpdateParameters (ProductInStockingPointInPeriodPlannings smartplanpispips, StrategyMacroPlan strategymacroplan, Period_MP periodstart,
|
Period_MP periodend, LibOBT_RunTaskSetting benchmarksetting) as AlgorithmRun
|
{
|
TextBody:
|
[*
|
// Martijn Apr-6-2016 (created)
|
// The automatic scaling algorithm should not be run on the autotuning copy
|
// Set the optimizer settings and parameters
|
param := this.Algorithm_Parameter();
|
issmartplan := param.IsSmartPlan();
|
tempalgorithmrun := this.Optimization().SetWeightsAndParams( issmartplan, strategymacroplan, benchmarksetting );
|
|
// Update planning horizon of optimizer
|
tempalgorithmrun.UpdatePlanningTime( periodstart, periodend );
|
|
// Martijn: We need this Transaction.Propagate to make sure we select the latest algorithm run that was just created in SetWeightsAndParams.
|
Transaction::Transaction().Propagate();
|
|
// The next algorithmrun is created in SetWeightsAndParams, so we need to call that method before we can set parameters of the lastrun
|
lastrun := tempalgorithmrun;
|
|
lastrun.UpdateParameters( periodstart,
|
periodend,
|
this.ResourceManager_MP().MaxThreadForOptimization()
|
);
|
|
if( param.IsInventoryOptimizationRun() )
|
{
|
// If this is an inventory optimization run and the last iteration has reached the specified number of simulations
|
// then create a new iteration
|
algorithm := this.DEPRECATED_InventoryOptimization();
|
if( guard( algorithm.LastIteration().LastSimulation().SimulationNumber() >= algorithm.NumberOfSimulations(), false ) )
|
{
|
// Create a new iteration
|
iteration := Iteration::Create( algorithm, guard( tempalgorithmrun.LastLevel().Level(), 5 ) );
|
// We need to update the move estimates and quantities before we can select the best move
|
Transaction::Transaction().Propagate( attribute( Move, Estimate ) );
|
Transaction::Transaction().Propagate( attribute( Move, Quantity ) );
|
currentmove := algorithm.SelectMoveForInventoryOptimization();
|
|
// If all moves have been tried, reset their status and select the most promising move
|
if( isnull( currentmove ) )
|
{
|
traverse( algorithm, Move, move )
|
{
|
move.HasBeenTried( false );
|
}
|
currentmove := algorithm.SelectMoveForInventoryOptimization();
|
}
|
// If the current move is still null, there is no available move to execute
|
if( not isnull( currentmove ) )
|
{
|
currentmove.Iteration( relset, iteration );
|
currentmove.QuantityForUndo( currentmove.Quantity() );
|
isundo := false;
|
currentmove.ExecuteMove( isundo );
|
}
|
}
|
}
|
|
return tempalgorithmrun;
|
*]
|
InterfaceProperties { Accessibility: 'Module' }
|
}
|