Quintiq file version 2.0
|
#parent: #root
|
MethodOverride PostHandleResult (
|
LibOpt_Task task,
|
RealVector kpi_pre
|
)
|
{
|
TextBody:
|
[*
|
runcontext := RunContextForCapacityPlanning::GetRunContextCapacityPlanning( task.Run() );
|
if ( isnull( this.CurrentSubOptimizerLevel() ) // when done we make sure current ptr is null
|
or ( runcontext.IsMetaIteration() and not this.IsBeyondFirstIteration() ) )
|
{
|
snapshot := this.LogKPI( task, Translations::LibOpt_SnapshotKPI_CommentPostHandleResult() );
|
if( isnull( this.RollbackKPI() ) )
|
{
|
// Throw a warning if it has not been thrown before in this snapshot.
|
if( not isnull( kpi_pre ) )
|
{
|
LibOpt_SnapshotWarning::Throw( task, Translations::LibOpt_Suboptimizer_NoRollbackKPI() );
|
}
|
}
|
else
|
{
|
kpi_post := RealVector::Construct( snapshot.astype( SnapshotMacroPlannerOptimizer ).RollbackKPI() );
|
change := construct( RealVector );
|
message := '';
|
isaccepted := this.RollbackKPI().CurrentScoreIsAccepted( task, kpi_pre, &kpi_post, &change, this.FocusLevel(), message );
|
|
should_rollback := not isaccepted;
|
|
// Store rollback KPI difference
|
if( task.Run().HasSnapshots() and not this.IsFullPlanMetaPriorFocus() )
|
{
|
LibOpt_SnapshotSuboptimizer::Create( task.Run(), kpi_pre, kpi_post, this.RollbackKPI(), should_rollback );
|
}
|
|
if( should_rollback )
|
{
|
if( not isnull( snapshot ) )
|
{
|
snapshot.IsRolledBack( true );
|
}
|
rcm := RunContextMeta::GetRunContextMeta( this.Run() );
|
if ( rcm.OptionStopOnRollback() )
|
{
|
this.Run().BreakpointEvent( relnew );
|
}
|
else
|
{
|
this.Rollback( kpi_pre, kpi_post, task );
|
}
|
}
|
}
|
}
|
this.IsBeyondFirstIteration( true ); // used for meta optimizer to make the first iteration of each focus level void planning ( only record KPIs)
|
*]
|
}
|