Hi all,
Any sample example would be really helpful.
Many thanks!
Hi all,
Any sample example would be really helpful.
Many thanks!
The most straightforward approach is to treat the two warehouses the same way. Somewhere in the constraints of your model you will presumably use parameters (data) representing the capacity of each warehouse in each month. Just set the capacity to zero in months where the warehouse is closed.
Paul
- PaulRubin
- 2013-08-31T20:27:33Z
The most straightforward approach is to treat the two warehouses the same way. Somewhere in the constraints of your model you will presumably use parameters (data) representing the capacity of each warehouse in each month. Just set the capacity to zero in months where the warehouse is closed.
Paul
Dear Paul,
Thanks for your response but the problem is I'm initializing the capacity of the warehouse based on the warehouse name(location) and not based on the month. In this case, I think I need to find some other solution like using If condition to supply for the first 3 months when the warehouse is opened and close the supply for the rest of the period when the warehouse is closed. I hope you understand this problem.
Can you help in this case please.
Prabhu
- Puppy26
- 2013-09-01T10:32:32Z
Dear Paul,
Thanks for your response but the problem is I'm initializing the capacity of the warehouse based on the warehouse name(location) and not based on the month. In this case, I think I need to find some other solution like using If condition to supply for the first 3 months when the warehouse is opened and close the supply for the rest of the period when the warehouse is closed. I hope you understand this problem.
Can you help in this case please.
Prabhu
Create a boolean/logical parameter (call it "open") indexed by warehouse name and month. Set it true in months that warehouse is open, false when closed. In the place where you would use the capacity (right hand side of a constraint, typically) say something like "if open(name, month) then capacity(name) else 0". Precise syntax depends on what language you are using, and is best asked on a forum specific to that language.
Paul
- PaulRubin
- 2013-09-01T14:26:19Z
Create a boolean/logical parameter (call it "open") indexed by warehouse name and month. Set it true in months that warehouse is open, false when closed. In the place where you would use the capacity (right hand side of a constraint, typically) say something like "if open(name, month) then capacity(name) else 0". Precise syntax depends on what language you are using, and is best asked on a forum specific to that language.
Paul
Paul,
Thanks for your feedback. I'm bit lost in your concept. I saw some example models in the OPL directory and some forum help, I have developed the model for opening and closing of depots but I still didnt get the answer I was looking for.
As said earlier, I have operations period of 5 years and 3 depots for an example. I want to develop a constraint in which 2 depots are opened on all the 5 years and 1 depot should be opened on first 3 years and on the 4th and 5th year, it should be closed. Ideally the result should be
Name Year 1 Year 2 Year 3 Year 4 Year 5
Depot1 Open Open Open Open Open
Depot 2 Open Open Open Open Open
Depot 3 Open Open Open Closed Closed
Right now, my constraint looks like this
Please advise me how I should modify to get the results as I mentioned. For your reference, I have attached my code.
Many thanks!
- Puppy26
- 2013-09-04T19:12:40Z
Paul,
Thanks for your feedback. I'm bit lost in your concept. I saw some example models in the OPL directory and some forum help, I have developed the model for opening and closing of depots but I still didnt get the answer I was looking for.
As said earlier, I have operations period of 5 years and 3 depots for an example. I want to develop a constraint in which 2 depots are opened on all the 5 years and 1 depot should be opened on first 3 years and on the 4th and 5th year, it should be closed. Ideally the result should be
Name Year 1 Year 2 Year 3 Year 4 Year 5
Depot1 Open Open Open Open Open
Depot 2 Open Open Open Open Open
Depot 3 Open Open Open Closed ClosedRight now, my constraint looks like this
forall (d in Depots, y in 1..NbYears-1)Depotstaysclosed:Open [d][y]<= Open[d] [y+1];Please advise me how I should modify to get the results as I mentioned. For your reference, I have attached my code.
Many thanks!
If the purpose of your "Depotstaysclosed" constraint is to say that once a depot closes it stays closed, and if you expect Open[d][y] to be 1 if depot d is open in year y and 0 if it is closed, then you have written the constraint incorrectly. Try substituting the values from your table into the constraint and you should quickly identify the error.