| Quintiq file version 2.0 | 
| #parent: #root | 
| Method SetCPLEXParametersHierarchicalGoal ( | 
|   MathematicalProgram program, | 
|   const StrategyLevelMacroPlan runlevel, | 
|   MPGoal goal | 
| ) const | 
| { | 
|   Description: 'Set the parameters (time limit, gap, etc) of the optimizer, according to setting per iteration' | 
|   TextBody: | 
|   [* | 
|     goal.ParameterSet().Flush();  | 
|     runcontext := this.GetRunContextConst();  | 
|      | 
|     // set runlevel abs / rel gap  | 
|     if ( not runcontext.IsMetaIteration() )  | 
|     { | 
|       if( runlevel.UseAbsoluteGap() ) | 
|       { | 
|         goal.ParameterSet().Set( 2008, runlevel.AbsoluteGap() );      // absolute gap tolerance | 
|         goal.ParameterSet().Set( 2009, 0.0 ); // explicitly must set rel gap to 0, otherwise solver can still terminate early based on that  | 
|       } | 
|       else | 
|       { | 
|         goal.ParameterSet().Set( 2009, runlevel.RelativeGap() );      // relative gap tolerance | 
|         goal.ParameterSet().Set( 2008, 0.0 ); // explicitly must set abs gap to 0, otherwise solver can still terminate early based on that  | 
|       } | 
|     } | 
|        | 
|     // set specific setting from solver settings object | 
|     this.ActivateSolverSettingsHierarchical( program, runlevel, goal, runcontext );        // activate the solver settings for the next level | 
|      | 
|     // set time limit   | 
|     timelimit := [Real]runlevel.TimeLimit(); | 
|     timelimitcplexparamnumber := 1039;  | 
|     if ( runcontext.IsMetaIteration() )  | 
|     { | 
|       rcm := this.GetRunContextMeta(); | 
|       timelimit := 2 * rcm.OptionMaxTimePerIterationSeconds(); // set time out to be twice the target time used for tuning | 
|     } | 
|     goal.ParameterSet().Set( timelimitcplexparamnumber, timelimit ); | 
|      | 
|     // set AbsTol, RelTol | 
|     if ( runlevel.UseHierarchicalSolverRelTolerance() )  | 
|     { | 
|       goal.RelTolerance( runlevel.HierarchicalCPLEXRelTolerance() ); // note solver documentation. Not used for LP.  | 
|     } | 
|     if ( runlevel.UseHierarchicalSolverAbsTolerance() )  | 
|     { | 
|       goal.AbsTolerance( runlevel.HierarchicalCPLEXAbsTolerance() );  | 
|     } | 
|   *] | 
|   InterfaceProperties { Accessibility: 'Module' } | 
| } |