The Equation gives me wrong result

Hi! My model has this equation

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

In this equation, makes sure the shape of a rectangle is equal to a fixed area, X[k,j] and Y[k,j] are variables and area[k] is a fixed parameter. but I solve it with baron, the shape indicated has not the same value of the fixed area. for example with this solution,

X[1,1] = -3.35  X[1,2] = -1.42  X[1,3] = -1.42  X[1,4] = -3.35
Y[1,1] = -4.20  Y[1,2] = -4.20  Y[1,3] = -1.42  Y[1,4] = -1.42

With these points, in theory i have a rectangle with a area 4.
but when I resolve only this equation in another software the result is total different (5.36). And with the commands

display area.lb;
display area.body;
display area.ub;

show me the value 4 and not 5.36. any idea why this happen?

test.dat (507 Bytes)
test.mod (2.1 KB)
test.run (606 Bytes)

Thank you

Constraint are is an equality with the constant term area[k], which is 4 for all k. So in any feasible solution, are.lb, are.body, and are.ub will be 4.

However, it looks like there is a ) in constraint are that is in the wrong place. It’s more obvious when some line breaks are added:

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

Also when I run BARON on your problem, it reports

BARON 23.3.11 (2023.03.11): 28185 iterations, CPU time limit reached.
Objective 3.457036724

By default, BARON has a time limit of 500 seconds. After that much time, it stops and returns the best solution found so far, which may not be the optimal solution. You can tell BARON to run longer; for example, to set a limit of 1500 seconds, before solve you can set some options like this:

option baron_options 'maxtime=1500 outlev=1';

(The setting outlev=1 tells BARON to display a log of its progress, which is useful for long runs.)

1 Like