Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

Trying to implement a binary variable for switching on/off new machines

  • 1.  Trying to implement a binary variable for switching on/off new machines

    Posted 11/11/12 12:55 PM

    Originally posted by: SystemAdmin


    Hello Guys,

    I do have to solve a cost minimizing problem for a for a factory with several machines which can be turned on and off.
    For turning on a machine you have to charge starting cost. Turning it off is free.

    These are the decision variables we use:
    dvar float+ MachineUsePeriodType; //These are the machines we use in period p of type t

    dvar float NewMachinesPeriodType; //This variable includes the differences between MachineUse of a certain type in period p and in period p-1
    dexpr float StartupCost = sum (p in Period, t in Type) StartCost[t] * NewMachines[p][t]; //This is the expression which directly goes into our objective function

    The following are the constraints we successfully used for creating the values for NewMachines over all periods and types:

    forall(p in Period, t in Type)
    ctMaxMachineUse[p][t]: MachineUse[p][t] <= MaxMachine[t];
    forall (p in Period, t in Type)
    if (p==1) MachineUse[p][t] == NewMachines[p][t];
    forall (p in 2..lastPeriod, t in Type) MachineUse[p][t]-MachineUsep-1[t]==NewMachines[p][t];
    Now the problem is that NewMachines[p][t] can also be negative when having turned of certain machines. The consequence is that these values (<0) also go into the objective negatively. Therefore we need to create a binary variable which is 0 if NewMachines<=0 and which is 1 if NewMachines>0...

    We tried to reach this through an if constraint but it's not possible to implement a decision variable into the if constraint like if(MachineUse[p][t]<=0) binvar==0. We also tried to create an auxiliary variable which takes all the values of NewMachines[p][t] through a forall statement and then to insert this auxiliary variable into our if constraint in order to create the binary variable. This firstly appeared to be a right solution but in fact it manipulates all computed values and sets all machine used = 0.

    I hope somebody has an idea how to solve this problem. Thanks for your help in advance.
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Trying to implement a binary variable for switching on/off new machines

    Posted 11/16/12 06:51 PM

    Originally posted by: davidoff


    Hello

    Is that wrong if you simply minimize the positive par of NewMachines variables, e.g introduce
    dvar float+ newMachinesPos[PeriodType]
    dvar float+ newMachinesNeg[PeriodType]
    


    the constraints
    MachineUse[p][t]-MachineUse[p-1[t] == newMachinesPos[p,t] - newMachinesNeg[p,t]
    


    and in the objective function, you only keep the positive increase in newMachines
    minimize sum(p,t) newMachinesPos[p,t]
    


    David
    #DecisionOptimization
    #OPLusingCPLEXOptimizer