haorenhui
2023-10-30 6d6cc10d9e8e242661da7fd655dec155a09d676c
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
Quintiq file version 2.0
#parent: #root
Method InitForScaling (
  CapacityPlanningSuboptimizer_CapacityPlanningAlgorithm program
)
{
  TextBody:
  [*
    // Update the constraint statistics for automatic scaling
    debuginfo(  '>> Init for scaling. ' );
    
    //moving all updates on variables into the handle feasible, so methods can be read only. Originally we call with the unscaled(non cplex value) then divide to get cplex bound
    //so now we start with the actual cplex bound in the call so no need to scale by dividing. Only difference would be squashing tiny values 
    traverse(  program, Variables, var, AlgorithmScaling::IsVariableForScaling( var ) ) 
    { 
      bound := var.LowerBound(); 
      if ( bound.IsFinite() )
      {
        this.UpdateMinMaxBound( bound, var );
      }
      bound := var.UpperBound(); 
      if ( bound.IsFinite() ) 
      {
        this.UpdateMinMaxBound( bound, var ); 
      }
    } 
    this.Optimization().astype( Optimization ).AlgorithmScaling().UpdateConstraintStatistics( program );
    debuginfo(  '<< Done init' );
  *]
  InterfaceProperties { Accessibility: 'Module' }
}