How I can model this

I don´t know how model this, with these equations, I can define the shape of a rectangle, X and Y are variables. Is there a way to write an equation when i = 1,2,3 can i get this equations?

eq5..  ((x2-x1)*(y2-y1))+((x3-x2)*(y3-y2))=e=0;
eq6..  ((x3-x2)*(y3-y2))+((x4-x3)*(y4-y3))=e=0;
eq7..  ((x4-x3)*(y4-y3))+((x1-x4)*(y1-y4))=e=0;

The problem is especially with the last equation
Any ideas?
Thanks

These are statements in the GAMS modeling language, but since you posted them in the AMPL user forum, you must be wanting to rewrite them in AMPL.

To get x1 and y1 rather than x5 and y5 in the last equation, you can compute the indexes using AMPL’s mod function in an expression:

   (x[j+1]-x[j])*(y[j+1]-y[j]) + 
   (x[((j+1) mod 4)+1]-x[j+1])*(y[((j+1) mod 4)+1]-y[j+1]) = 0;

This expression can be used inside an AMPL subject to statement indexed over {j in 1..3}.

1 Like

Thanks for the help, its works fine!