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 p1
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]MachineUsep1[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.
Topic
This topic has been locked.
1 reply
Latest Post
 20121116T23:50:52Z by davidoff
ACCEPTED ANSWER
Pinned topic Trying to implement a binary variable for switching on/off new machines
20121111T17:55:10Z

Answered question
This question has been answered.
Unanswered question
This question has not been answered yet.
Updated on 20121116T23:50:52Z at 20121116T23:50:52Z by davidoff

ACCEPTED ANSWER
Re: Trying to implement a binary variable for switching on/off new machines
20121116T23:50:52Z in response to SystemAdminHello
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[p1[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]
DavidUpdated on 20140326T05:52:29Z at 20140326T05:52:29Z by ironman