chenqinghong
2024-05-07 3ec06a830367465068963156dcc1d8e522571c13
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
34
35
Quintiq file version 2.0
#parent: #root
Method AddUnitPeriodsForTripHelper (
  UnitPeriod unitperiod,
  Trip trip
)
{
  Description: 'add unit periods to sub puzzle neighborhood based on trip'
  TextBody:
  [*
    // Add the related unit periods to unitperiodsforoptimization (only do this if at least one of the trips is valid)
    unitperiod.LibOpt_ScopeAddHelper( relset, this ); 
              
    // If the trip is from a TransportQuantity Unit, then add the departure period as well, to constrain the transport capacity
    if( trip.LaneLeg().Lane().Unit().HasCapacityTypeTransportQuantity() )
    {
      departureunitperiod := trip.DepartureUnitPeriod();
      
      departureunitperiod.LibOpt_ScopeAddHelper( relset, this );  
    }
    else if( trip.LaneLeg().Lane().Unit().HasCapacityTypeTransportTime() )
    {
      arrivalunitperiod := trip.ArrivalUnitPeriod();  
      departureunitperiod := trip.DepartureUnitPeriod();
      current := departureunitperiod; 
      arrivalstart := guard( arrivalunitperiod.Start(), DateTime::MaxDateTime() ); 
      while( not isnull( current ) and current.Start() <= arrivalstart ) 
      {
        current.LibOpt_ScopeAddHelper( relset, this ); 
        current := current.Next().astype( UnitPeriodTransportBase );  
      }
    }
  *]
  InterfaceProperties { Accessibility: 'Module' }
}