Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method InitVariablesForKPITotalValue ( 
 | 
  CapacityPlanningSuboptimizer_CapacityPlanningAlgorithm program, 
 | 
  const RunContextForCapacityPlanning runcontext, 
 | 
  const LibOpt_Scope scope 
 | 
) const 
 | 
{ 
 | 
  Description: 'Initialize all KPI variables that used as goal' 
 | 
  TextBody: 
 | 
  [* 
 | 
    // Non financial kpis  
 | 
    // TotalBlending variable UoM: Unit 
 | 
    program.TotalBlendingVariables().New(); 
 | 
    // TotalCampaign variable UoM: Unit 
 | 
     
 | 
    totalcampvar := program.TotalCampaignVariables().New(); 
 | 
    if ( not runcontext.UseCampaignSequenceOptimizer() )  
 | 
    { 
 | 
      totalcampvar.LowerBound( Real::MinReal() ); // due to transition output maximization 
 | 
      // TotalCampaignTransitionOutput variable UoM: Unit 
 | 
      program.TotalCampaignTransitionOutputVariables().New(); 
 | 
    }  
 | 
    // TotalDifferenceInDemandDays variable UoM: Days 
 | 
    program.TotalInventoryMixBalancingVariables().New(); 
 | 
    // TotalFulfillment variable UoM: Default 
 | 
    program.TotalFulfillmentVariables().New(); 
 | 
    // TotalLotSize variable UoM: Unit 
 | 
    program.TotalLotSizeVariables().New(); 
 | 
    // TotalMaximumInventoryLevel variable UoM: PISP 
 | 
    program.TotalMaximumInventoryLevelVariables().New(); 
 | 
    // TotalMinimumInventoryLevel variable UoM: PISP 
 | 
    program.TotalMinimumInventoryLevelVariables().New(); 
 | 
    // TotalMaximumSupply variable UoM: Unit 
 | 
    program.TotalMaximumSupplyVariables().New(); 
 | 
    // TotalMinimumSupply variable UoM: Unit 
 | 
    program.TotalMinimumSupplyVariables().New(); 
 | 
    // TotalMinimumUnitCapacity variable UoM: Unit 
 | 
    program.TotalMinimumUnitCapacityVariables().New(); 
 | 
    // TotalMinimumUnitSecondaryCapacity variable UoM: TransportCapacity 
 | 
    program.TotalMinimumUnitSecondaryCapacityVariables().New(); 
 | 
    // TotalPostPonementPenalty variable UoM: Monetary 
 | 
    program.TotalPostponementPenaltyVariables().New(); 
 | 
    // TotalProcessMaximumQuantity variable UoM: Unit 
 | 
    program.TotalProcessMaximumQuantityVariables().New(); 
 | 
    // TotalSalesDemandPriority variable UoM: Default. Priority can take a negative value, in which case the total SDPriority could also become negative 
 | 
    var := program.TotalSalesDemandPriorityVariables().New(); 
 | 
    var.LowerBound( Real::MinReal() ); 
 | 
    // TotalFulfillmentTarget variable UoM: Default 
 | 
    program.TotalFulfillmentTargetVariables().New(); 
 | 
    // TotalServiceLevel variable UoM: Default 
 | 
    program.TotalServiceLevelVariables().New(); 
 | 
    // TotalSlack variable UoM: Default 
 | 
    program.TotalSlackVariables().New(); 
 | 
    // TotalSlackUserSupply variable UoM: PISP 
 | 
    program.TotalSlackUserSupplyVariables().New(); 
 | 
    // TotalStockingPointCapacity variable UoM: SP 
 | 
    program.TotalStockingPointCapacityVariables().New(); 
 | 
    // TotalSupplyTarget variable UoM: Unit 
 | 
    program.TotalSupplyTargetVariables().New(); 
 | 
    // TotalTargetInventoryLevel variable UoM: PISP 
 | 
    program.TotalTargetInvLevelVariables().New(); 
 | 
    // TotalUnitCapacity variable UoM: Unit 
 | 
    program.TotalUnitCapacityVariables().New(); 
 | 
    // TotalUnitSecondary variable UoM: TransportCapacity 
 | 
    program.TotalUnitSecondaryCapacityVariables().New(); 
 | 
    // TotalCapacitySmoothing variable  
 | 
    program.TotalCapacitySmoothingSlackVariables().New();  
 | 
    // TotalExpiredQty variable 
 | 
    program.TotalExpiredQtyVariables().New(); 
 | 
    // TotalCO2Emission variable UoM: CO2 
 | 
    program.TotalCO2EmissionVariables().New(); 
 | 
    // TotalShiftPatternChangesPenalty variable UoM: Default 
 | 
    program.TotalShiftPatternChangesPenaltyVariables().New(); 
 | 
    // Account kpis 
 | 
     
 | 
    accounts := scope.GetAccountsInOptimizerRunConst();  
 | 
    traverse( accounts, Elements, account ) 
 | 
    { 
 | 
      traverse( account, AccountAssignment.AccountCostDriver, driver ) 
 | 
      { 
 | 
        // Account KPI variables UoM: Monetary                     
 | 
        if( driver.Name() = Translations::MP_AccountAssignmentCostDriverFixed() )                 // fixed 
 | 
        { 
 | 
          // we don't need fixed cost in the optimizer.   
 | 
        } 
 | 
        else if ( driver.Name() = Translations::MP_AccountAssignmentCostDriverInventorySupply() )  
 | 
        { 
 | 
          // cost driver inventory supply not applicable in optimizer                             // inventory supply 
 | 
        } 
 | 
        else if( driver.Name() = Translations::MP_AccountAssignmentCostDriverStaffing() )         // staffing 
 | 
        { 
 | 
          program.DriverStaffingVariables().New( account, driver ); 
 | 
        } 
 | 
        else if( driver.Name() = Translations::MP_AccountAssignmentCostDriverInventoryValue() )   // inventory value 
 | 
        { 
 | 
          varval := program.DriverInventoryValueVariables().New( account, driver ); 
 | 
          varval.UpperBound( 0.0 );  // currently unused 
 | 
          varval.LowerBound( 0.0 );  
 | 
        } 
 | 
        else if( driver.Name() = Translations::MP_AccountAssignmentCostDriverInventoryHolding() ) // inventory holding 
 | 
        { 
 | 
          program.DriverInventoryHoldingVariables().New( account, driver ); 
 | 
        } 
 | 
        else if( driver.Name() = Translations::MP_AccountAssignmentCostDriverNrOfUnits() )        // nr of units 
 | 
        { 
 | 
          program.DriverNrOfUnitsVariables().New( account, driver ); // currently unused 
 | 
        } 
 | 
        else if( driver.Name() = Translations::MP_AccountAssignmentCostDriverSales() )            // sales 
 | 
        { 
 | 
          program.DriverSalesVariables().New( account, driver ); 
 | 
        } 
 | 
        else if( driver.Name() = Translations::MP_AccountAssignmentCostDriverTime() )             // time 
 | 
        { 
 | 
          program.DriverTimeVariables().New( account, driver ); 
 | 
        } 
 | 
        else if( driver.Name() = Translations::MP_AccountAssignmentCostDriverVolume() )           // volume 
 | 
        { 
 | 
          program.DriverVolumeVariables().New( account, driver ); 
 | 
        } 
 | 
        else if( driver.Name() = Translations::MP_AccountAssignmentCostDriverLot() )              // Lot 
 | 
        { 
 | 
          program.DriverLotVariables().New( account, driver ); 
 | 
        } 
 | 
        else if( driver.Name() = Translations::MP_AccountAssignmentCostDriverChangeover() )        // Changeover 
 | 
        { 
 | 
          program.DriverChangeoverVariables().New( account, driver ); 
 | 
        } 
 | 
        else if ( driver.Name() = Translations::MP_AccountAssignmentCostDriverOneTime() )         // One-time cost 
 | 
        { 
 | 
          program.DriverOneTimeVariables().New( account, driver );  
 | 
        } 
 | 
        else 
 | 
        { 
 | 
          info( '>>> Can not create driver variable for account ', account.Name(), ' and driver name:', driver.Name() );   
 | 
        } 
 | 
      } 
 | 
    } 
 | 
     
 | 
    if ( runcontext.IsMetaIteration() )  
 | 
    { 
 | 
      program.TotalStockingPointCapacityMetaVariables().New();  
 | 
    } 
 | 
       
 | 
    // Create goal variables for each level 
 | 
    this.InitVariablesForLevelGoal( program, runcontext ); 
 | 
  *] 
 | 
  InterfaceProperties { Accessibility: 'Module' } 
 | 
} 
 |