Why is this happen?

Hi, in a NLP model which i’m working, it has equations like this:

s.t. are{k in pol}:((X[k,4]-X[k,3])^2 + (Y[k,2]-Y[k,1])^2) * ((X[k,3]-X[k,2]^2) + (Y[k,3]-Y[k,2])^2)==area[k]**2;

area[k] in this case is a parameter,

when i solve it, i get results like this: -0.500143 and not the parameter’s value which is 9

Any idea why is happen?

I’m use the baron solver

Thank you
test.dat (59 Bytes)
test.mod (1.9 KB)
test.run (231 Bytes)

When I run the example that you uploaded, BARON reports:

               *** Max. allowable time exceeded ***      
              *** No feasible solution was found ***

 Wall clock time:                   511.20
 Total CPU time used:               500.00

This means that BARON reached its default limit of 500 seconds, without being able to find any feasible solution to your problem. As a result, BARON did not return any useful solution to AMPL. Here are some things you could do to try to improve your results:

  • If you give BARON more time, it might eventually find feasible solutions. To change the time limit, add maxtime=??? to your baron_options string — where ??? is replaced by some number larger than 500.

  • Solvers usually work much better when the variables have upper and lower bounds in the model. Using your knowledge of the application, try to determine bounds that are reasonably tight, but not so tight that they could cut off an optimal solution. You can specify bounds directly in the var statements or by writing additional constraints.

  • Square root functions are hard for solvers to work with. Try to reformulate to remove square roots from constraints fl1, . . . , fl5, f12, . . . , f14, and suv.

If you try these things and BARON is still not able to find a feasible solution, then it is possible that no feasible solution exists. Then you will need to study the model and data to learn why there is no feasible solution, and to determine how you can fix the model and/or data to make feasible solutions possible.

thanks for the respond, the model gave me a factible solution already, but i’m still having the same question, here’s a update of the model
test.dat (605 Bytes)
test.mod (2.2 KB)
test.run (231 Bytes)


You have specified firstloc=1 in the baron_options string, so BARON stops as soon as it finds one locally optimal solution, with objective value 3.088834135. At this solution, the constraints are[k] that you mentioned are satisfied by the solution: the expression on the left and the constant on the right are both 16.

If you instead set

option baron_options 'barstats outlev=1';

then you will see (in the “Upper bound” column) that BARON finds better solutions. After 500 seconds (the default time limit) it returns the best solution that it has found, with objective value 1.99925654355.

What question do you have now? You mentioned,

when i solve it, i get results like this: -0.500143 and not the parameter’s value which is 9

but I do not see a result value of -0.500143 or a parameter value of 9 in the solution that BARON is returning.

thanks for the answer,
My original question is:
I run the model, works fine and the solution is factible, but when i use the next command

display are;

this is showed

are [*] :=
1 0.0193354
2 0.02486

Why the software showed these results, when the solutions must be equal same as a parameter, in this case must be 16 in both equations? is there something wrong in the way i used the command?

Thank you for your time`

When you display the constraint name by itself, AMPL gives you the dual variables associated with that constraint. The result is the same as giving the constraint name with the .dual suffix:

ampl: display are.dual;
are.dual [*] :=
1  0.0195358
2  0.0368532

To see the values you are looking for, use these suffixes instead:

  • .body for the sum of all the terms involving variables
  • .lb for the lower bound that the constraint places on the body
  • .ub for the upper bound that the constraint places on the body

In the case of are, since it is an = constraint, the lower and upper bound and the body will have the same value:

ampl: display are.lb, are.body, are.ub;
: are.lb are.body are.ub    :=
1    16      16      16
2    16      16      16
1 Like