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
26
27
28
29
30
31
32
33
Quintiq file version 2.0
#parent: #root
Method GetUnusedPIT (
  LibOpt_Scope scope,
  output owning ProductInTrips unusedpits_o,
  output Number nrofunusedtrip_o
)
{
  Description: 'Retrieve all the unused pit from algorithmrun, count trip that is totally not in used'
  TextBody:
  [*
    noisethreshold := this.Optimization().astype( Optimization ).MacroPlan().GlobalParameters_MP().NoiseThresholdOptimizerOutput();
    
    unusedpits_o := selectset( scope.GetPeriodInOptimizerRun(), 
                               Elements.UnitPeriod.PeriodTask_MP.astype( PeriodTaskLaneLeg ).Trip.ProductInTrip, 
                               pit, 
                               true, 
                               pit.GetIsUnused( noisethreshold ) ); 
    
    // get all the trip in that has unused pits
    tripfromunused := selectset(  unusedpits_o, Elements.Trip, t, true, true ); 
    totaltripfromunusedpit := tripfromunused.Size(); 
    // exclude the trip that still has pit with optimizer quantity or has feedback or has user quantity
    excludetrips := counter(  tripfromunused, 
                              Elements, 
                              trip, 
                              true, 
                              exists( trip, ProductInTrip, pit, true, not pit.GetIsUnused( noisethreshold ) ) );
    
    nrofunusedtrip_o := totaltripfromunusedpit - excludetrips;
  *]
  InterfaceProperties { Accessibility: 'Module' }
}