problem in solving indexed problems

42 views
Skip to first unread message

Hyperplane

unread,
Feb 24, 2015, 4:39:18 AM2/24/15
to am...@googlegroups.com
Dear all,

I've encountered problem when I tried to solve a set of indexed problem (the pescore{i in 1..Bells}). I am not sure where I was wrong in defining the problem. 


Thanks,

Hyperplane
improvedNash5_3.mod
improvedNash5_3.run
trial_Nash5_3.dat

Hyperplane

unread,
Feb 25, 2015, 5:10:46 AM2/25/15
to am...@googlegroups.com
I've simplified the program for ease of reading. Can some one help me find out the problem, or is it some bug of AMPL? I'll very much appreciate it.

在 2015年2月24日星期二 UTC+8下午5:39:18,Hyperplane写道:
example.dat
example.mod
example.run

Robert Fourer

unread,
Feb 25, 2015, 11:17:31 AM2/25/15
to am...@googlegroups.com
I see this error message:

Error at _cmdno 47 executing "solve" command
(file ../example.run, line 27, offset 558):
error processing constraint equality[2,1]:
no value for NEvalue[2,1]

And indeed your constraint equality[2,1] refers to the param NEvalue[2,1], but your data file does not give any value for NEvalue[2,1]. Note that a "." in a data file means "no value given" unless a default value is specified using a phrase like "default 0" (www.ampl.com/BOOK/CHAPTERS/12-data.pdf#page=18).

Bob Fourer
am...@googlegroups.com

=======

Hyperplane

unread,
Feb 25, 2015, 10:29:28 PM2/25/15
to am...@googlegroups.com, 4...@ampl.com
Thanks for replying. In fact, when solving pescore[2] in the loop of the run file, equality[2,1] is not effective, but only equality[1,2] and equality[2,2] works. I cannot understand why NEvalue[2,1] and equality[2,1] is needed, I intend not to use it.

在 2015年2月26日星期四 UTC+8上午12:17:31,AMPL Optimization写道:

Robert Fourer

unread,
Feb 26, 2015, 1:14:53 PM2/26/15
to am...@googlegroups.com
Since you have written

subj to equality {k in 1..m, i in 1..Bells}: ...

AMPL generates a constraint for every combination of k in 1..m and i in 1..Bells, and when it finds that constraint equality[2,1] has a reference to the parameter Nevalue[2,1] which has no value, you get an error message. If you do not want AMPL to generate the constraint equality[2,1], you have to state that explicitly in the definition of the constraint. One simple way to do this is to define

param NEvalue{1..snumber,1..Bells} default 0;

and then write the constraint as

subj to equality {k in 1..m, i in 1..Bells: NEvalue[k,i] > 0}: ...

Hyperplane

unread,
Feb 26, 2015, 10:57:22 PM2/26/15
to am...@googlegroups.com, 4...@ampl.com
I see! The problem is well solved. Thanks a lot!

在 2015年2月27日星期五 UTC+8上午2:14:53,AMPL Optimization写道:
Reply all
Reply to author
Forward
0 new messages