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.