RE: [AMPL 12732] Rounding to nearest whole problem

5 views
Skip to first unread message

Robert Fourer

unread,
Oct 14, 2016, 6:20:26 PM10/14/16
to am...@googlegroups.com
The first section of Chapter 20 of the AMPL book (http://ampl.com/BOOK/CHAPTERS/23-integer.pdf) explains how write a model so that variables are required to take whole number values.

Bob Fourer
am...@googlegroups.com

=======

From: am...@googlegroups.com [mailto:am...@googlegroups.com] On Behalf Of Derek Paquet
Sent: Wednesday, October 12, 2016 10:58 AM
To: AMPL Modeling Language
Subject: [AMPL 12732] Rounding to nearest whole problem

Hi, I hope you guys could help me with this one.

As the question I have is "how much car should you produce?", I would like to add a constraint in my problem that number of cars must be whole (like 1 car, 2 cars, 3 cars, etc.), not 1,33 cars or 2,82 cars as it is impossible. If I get 2,82 cars as an answer, I would like the answer to be 2 cars instead of 2,82 cars or even 3 cars (rounded to next whole).

What would be the constraint? As X is variable of decision.


Reply all
Reply to author
Forward
0 new messages