lazhen
2025-01-09 8afe90b633046db39042aada36b88193062f8cff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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;
  *]
}