line 35 (offset): parameter ....already define

268 views
Skip to first unread message

Nasiru Abdullahi

unread,
Aug 18, 2014, 12:00:58 PM8/18/14
to 4r...@ampl.com, am...@googlegroups.com
Good day, Sirs
these are the error message I have been battling with, can any one
vail me out pls.
" param dcapacity: dcap_min dcap_max:= " I received several several
errors messages like:
line 35 (offset 1580):
dcapacity['dcap_min'] already defined
contex: dep2 >>>9100<<< 26371
and several similar erros

Then when I removed "dcapacity" from the param declaration in the
table, I got another error message:
line 33 (offset 1538):
1 item(s) missing in last line of table, which starts with "dcap_max"
Context: param dcap_min dcap_max >>>:= <<<<
line 35 (offet 1569):
expected number
context: >>> dep2 <<< 9100 26371
thanks
Nasir A
kmwdp_ff5.mod
kmwdp_ff5.dat

Robert Fourer

unread,
Aug 18, 2014, 12:22:38 PM8/18/14
to am...@googlegroups.com
You have these 3 parameters in your model:

param dcap_min {depots} >=0;
param dcap_max {k in depots} >=0;
param dcapacity {k in depots} >= dcap_min[k], <= dcap_max[k];

AMPL expects you to provide data for all 3 of these parameters. In the data file that you posted, you provide data for dcap_min and dcap_max, but you are missing a ":" character in your syntax; the data statement should begin with

param: dcap_min dcap_max :=
dep1 4500 55314
dep2 9100 26371

As your model is written, however, you also need to give data for param dcapacity, and I do not see dcapacity mentioned in your data file. To give values for all three parameters your data file would need -- as noted in a previous post -- a statement that starts something like this (although the actual numbers would be different):

param: dcap_min dcapacity dcap_max :=
dep1 4500 22907 55314
dep2 9100 13558 26371

Specifying dcapacity to be ">= dcap_min[k], <= dcap_max[k]" will not provide a value for dcapacity; AMPL will only use these inequalities to check that each value dcapacity[k] that you provide in the data is >= dcap_min[k] and also <= dcap_max[k], and to give an error message if not. If you wanted AMPL to choose a value of dcapacity[k] that is between dcap_min[k] and dcap_max[k], then you would need to make dcapacity a variable and let the solver choose the value.

Bob Fourer
am...@googlegroups.com

Nasiru Abdullahi

unread,
Aug 19, 2014, 12:13:05 PM8/19/14
to am...@googlegroups.com
Thanks Prof.
it works
Best regard
> --
> You received this message because you are subscribed to the Google Groups
> "AMPL Modeling Language" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ampl+uns...@googlegroups.com.
> To post to this group, send email to am...@googlegroups.com.
> Visit this group at http://groups.google.com/group/ampl.
> For more options, visit https://groups.google.com/d/optout.
>

Nasiru Abdullahi

unread,
Aug 26, 2014, 11:12:37 AM8/26/14
to ampl, Robert Fourer
Good day Professor
I have edit the problem the way you suggested but I got the following message when i try to solve the problem using cplex and xpress solvers.
I have tried all these while to figure out the problem but to no avail. especially how the change from linear to non linear problem.

presolve, constraint alldemand['clt27']:
all variables eliminated, but lower bound = 1 > 0
presolve, Variable damount['dep5', 'clt20']:
impossible deduced bounds: lower = 0, upper = -1
presolve, variable damount['dep4','clt17']:
impossible deduced bounds: lower = 0, upper = -2
presolve, constraint alldemand['clt27']:
all variables eliminated, but lower bound = 1 > 0

When I decided to see the status using "option show_stats 1;" I got the following statements:

Presolve eliminates 120 constraints and 73 variables
Adjusted problem: 8 variables
4 non linear variables
4 linear variables
10 constaints, 12 non zeros
4 non linear constraints
6 linear constraint
6 equality constraints
4 inequality constraints
1 linear objective, 6 nonzeros
Thanks

kmwdp_ff5.mod
kmwdp_ff5.dat

Robert Fourer

unread,
Aug 27, 2014, 5:20:41 PM8/27/14
to am...@googlegroups.com
These messages from AMPL's "presolve" phase tell you that your problem has no feasible solution -- there is no way to assign values to the variables that will satisfy all of the constraints and variable bounds. For the two nonnegative variables listed, the constraints imply an upper bound that is less than zero; and for the two constraints listed, the other constraints and variable bounds imply a fixed value for all of the variables in the constraint, with the result that the constraint becomes an impossible relation such as 0 = 1. Use AMPL's "expand;" command to take a look at the constraints that were actually generated, and you will be able to figure out what error in your model is making your problem infeasible.

Bob Fourer
am...@googlegroups.com

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