Infinity error

8 views
Skip to first unread message

sahebe...@gmail.com

unread,
Apr 17, 2017, 3:25:39 PM4/17/17
to AMPL Modeling Language
Hi all,
I want to write this code but I receive an error.
What is the problem?

param cp_02 default infinity:= if (cp02 == infinity) then 0 else cp02;

How can I determine infinity???

WBR

Robert Fourer

unread,
Apr 18, 2017, 3:47:04 PM4/18/17
to am...@googlegroups.com
AMPL's reserved word for infinity is Infinity (with a capital I):

param cp_02 := if (cp02 == Infinity) then 0 else cp02;

It is not necessary to add "default Infinity" in this case since the if-then-else expression always assigns a value to cp_02.

Bob Fourer
am...@googlegroups.com

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