| Quintiq file version 2.0 | 
| #parent: #root | 
| MethodOverride HandleFeasible ( | 
|   MathematicalProgram program, | 
|   LibOpt_Task task | 
| ) as LibOpt_Scope | 
| { | 
|   TextBody: | 
|   [* | 
|     start := OS::PrecisionCounter();  | 
|     runcontext := this.GetRunContextConst();  | 
|      | 
|     isfirsthandlefeasiblecall := this.CurrentSubOptimizerLevel().IsFirst();  | 
|     isfirstnotlasthandlefeasiblecallatlevelzero := isfirsthandlefeasiblecall and not this.CurrentSubOptimizerLevel().IsLast() and this.CurrentSubOptimizerLevel().LevelNumber() = 0;  | 
|     if ( isfirsthandlefeasiblecall ) // initialize of cplex needs to be const for paralellization. Any non-const processing is moved into the delayed initialization called on return of first handle feasible/infeasible.  | 
|     { | 
|       this.DelayedInitialization( program.astype( CapacityPlanningSuboptimizer_CapacityPlanningAlgorithm ), task, runcontext, true );    | 
|     } | 
|      | 
|     this.LogDetailsCPLEX( program, '', task.Scope() ); | 
|      | 
|     qualityok := this.CanRescueSolution( program, task )  | 
|     passlevelzeroformeta := this.GetRunContextConst().IsMetaIteration()  | 
|                             and  isfirstnotlasthandlefeasiblecallatlevelzero // for meta we are willing to accept lower quality for the fixed level 0.  | 
|                             and not this.GetRunContextMeta().OptionUseHierarchicalCPLEXGoals() //  | 
|     if( qualityok or passlevelzeroformeta ) | 
|     { | 
|       this.CapacityPlanningAlgorithmHandleFeasiblePreProcessing( program.astype( CapacityPlanningSuboptimizer_CapacityPlanningAlgorithm ), runcontext, task ); | 
|     } | 
|     else | 
|     { | 
|       msg := 'Handle feasible aborted because quality insufficient';  | 
|       debuginfo( msg );  | 
|       this.DetailsCPLEX( this.DetailsCPLEX() + msg );  | 
|       this.HandleInfeasible( program, task );  | 
|     } | 
|     end := OS::PrecisionCounter();  | 
|     durationtotal := (end- start) / OS::PrecisionCounterFrequency();  | 
|     task.Log( 'Duration h-feasible total = ' +[String] durationtotal );  | 
|     return task.Scope(); | 
|   *] | 
| } |