Conditional constraint

19 views
Skip to first unread message

Derek Paquet

unread,
Oct 12, 2016, 1:59:41 PM10/12/16
to AMPL Modeling Language
The problem on wich I work is about making cars (2 models). There is two major constraints for making the cars. First one is, we have a certain quantity work hours to build the cars and the second one is, we have a certain amount of door to build them. 

Now, some months, there are doors left and some months there isn't, but there is never any work hours left. 

We can use extra hours for 15 more 5$ per hour. I want to add a constraint were we use extra hours only when there are doors left, and don't use them when there is no doors left so we don't waste money. 

Do you have any idea on how to write this constraint?

Thank you very much in advance ! 

Robert Fourer

unread,
Oct 17, 2016, 9:14:14 AM10/17/16
to am...@googlegroups.com
Probably you don't need any constraint for this. If you have one variable for the number of regular hours and one for the number of extra hours, and in your objective function the cost for regular hours is less than the cost for extra hours, then extra hours will be used only when it is profitable to do so. You should put upper bounds on these variables equal to the numbers of regular and extra hours available.

Bob Fourer
am...@googlegroups.com

=======
Reply all
Reply to author
Forward
0 new messages