Quintiq file version 2.0 
 | 
#parent: #root 
 | 
MethodOverride GetWeightFactor ( 
 | 
  const LibOpt_Task task 
 | 
) as Real 
 | 
{ 
 | 
  TextBody: 
 | 
  [* 
 | 
    runcontext := RunContextForCapacityPlanning::GetRunContextCapacityPlanningConst( task.Run() ) ;  
 | 
    wl := runcontext.WeightLevelNonFinancial();  
 | 
    candidates := LinkProbabilityUnitPeriod::GetCandidatesConst( task.Scope() );  
 | 
    weight := 0.0;  
 | 
    avail :=  ( ( wl.UnitCapacityWeight() > 0 and wl.UnitCapacityLevel() = this.FocusLevel() )  
 | 
                or ( wl.MinimumUnitCapacityWeight() > 0 and wl.MinimumUnitCapacityLevel() = this.FocusLevel() )  
 | 
                or ( this.FocusLevel() = 0 and runcontext.UseShiftOptimization()) ) // in case of min duration shift pattern problems 
 | 
              and candidates.Size() > 0;    
 | 
    if ( avail ) 
 | 
    { 
 | 
      weight := average(  candidates, Elements, c, true, c.EstimatedImprovementScore() );  
 | 
    }   
 | 
     
 | 
    debuginfo( 'UP[' + [String] weight + '] + #cand=' + [String]candidates.Size(), avail ); 
 | 
    return weight; 
 | 
  *] 
 | 
} 
 |