Topic
  • 1 reply
  • Latest Post - ‏2012-11-12T08:42:41Z by SystemAdmin
SystemAdmin
SystemAdmin
754 Posts

Pinned topic Binary variable for machine use

‏2012-11-12T00:38:28Z |
Hello Guys,

I do have to solve a cost minimizing problem 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+ MachineUse[p][t]; //These are the machines we use in period p of type t

dvar float NewMachines[p][t]; //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.
Updated on 2012-11-12T08:42:41Z at 2012-11-12T08:42:41Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    754 Posts

    Re: Binary variable for machine use

    ‏2012-11-12T08:42:41Z  
    This is a duplicate of this thread.