Equation Listing for nonlinear eqs

Solver related questions
Post Reply
robster
User
User
Posts: 2
Joined: 1 month ago

Equation Listing for nonlinear eqs

Post by robster » 1 month ago

I am a bit confused by the following part of the Documentation regarding the Equation Listing (https://www.gams.com/latest/docs/UG_GAM ... ionListing). It reads
Nonlinear equations are treated differently. If the coefficient of a variable in the equation listing is enclosed in parentheses, then the corresponding constraint is nonlinear, and the value of the coefficient depends on the activity levels of one or more of the variables. The listing is not algebraic, but shows the partial derivative of each variable evaluated at their current level values.
The following equation and associated level values are provided as an example:
eq1.. 2*sqr(x)*power(y,3) + 5*x - 1.5/y =e= 2; x.l = 2; y.l = 3 ;
and the equation appears in the Equation Listing as:
eq1.. (221)*x + (216.1667)*y =E= 2 ; (LHS = 225.5 ***)
I'll denote by f(x,y) = 2*x^2*y^3 + 5*x - 1.5/y the nonlinear function in question.
I understand that the values 221 and 216.1667 are the partial derivative of f with respect to x and y, respectively, evaluated in the point (x,y)=(2,3). However, it is not clear to me what the function 221*x + 216.1667*y has to do with the original function f.

The linearisation of f around the point (x,y)=(2,3) is given by

f(2,3) + f_x(2,3) * (x-2) + f_y(2,3) * (y-3)

(where f_x denotes the partial derivative of f w.r.t. x) which evaluates to

225.5 + 221 * (x-2) + 216.1667 * (y-3)

(Incidentally, plugging in (x,y)=(2,3) gives 225.5, which is mentioned above as the LHS value.)


If the output is meant to represent the linearisation, why does it read
eq1.. (221)*x + (216.1667)*y =E= 2 ; (LHS = 225.5 ***)
instead of, for example,

225.5 + 221 * (x-2) + 216.1667 * (y-3) =E= 2

?
Is it just confusing for no reason, or is there a deeper meaning?

User avatar
bussieck
Moderator
Moderator
Posts: 859
Joined: 6 years ago

Re: Equation Listing for nonlinear eqs

Post by bussieck » 1 month ago

This representation gives you the Jacobian matrix (https://en.wikipedia.org/wiki/Jacobian_ ... eterminant) at the input point. As the wikipedia article demonstrates this gives you lots of good local information around your point.

-Michael

robster
User
User
Posts: 2
Joined: 1 month ago

Re: Equation Listing for nonlinear eqs

Post by robster » 1 month ago

Thank you. I see that

221*x + 216.1667*y = J(2,3) * (x,y)

where J(x,y) denotes the Jacobian, but I would maintain that the original equation
2*sqr(x)*power(y,3) + 5*x - 1.5/y =e= 2
and the equation listing output
(221)*x + (216.1667)*y =E= 2
are completely unrelated. The linearisation of the nonlinear function is f(2,3) + J(2,3) * (x-2,y-3), it is not J(2,3) * (x,y). In my view, the equation J(2,3) * (x,y) = 2 has no meaning.

The other odd element is the information about the LHS in the output line:
eq1.. (221)*x + (216.1667)*y =E= 2 ; (LHS = 225.5 ***)
Clearly, 221*2 + 216.1667*3 is not 225.5. Instead, it is the original function which in (x,y)=(2,3) indeed evaluates to 225.5 (as does, trivially, its local linearisation).

Perhaps there is no deeper meaning to this, and it is simply a slightly confusing (and technically incorrect) effort to provide information about the local behaviour of the function at the current level values... Let me know if I'm missing anything after all.

User avatar
dirkse
Moderator
Moderator
Posts: 194
Joined: 6 years ago
Location: Fairfax, VA

Re: Equation Listing for nonlinear eqs

Post by dirkse » 1 month ago

Hi,

I think you understand the mathematical/numerical content that is there when a nonlinear equation is shown in the listing file. It seems you are not on the same page about the particular form used to convey this information; perhaps I can help explain how this evolved. For simplicity, I just used one variable:

Code: Select all

g..  power(x,3) + x*x =E= 20;
h..  16 * x =E= 52;
For a linear row, the equation listing shows (almost) everything there is to say about each row, e.g.
h.. 16*x =E= 52 ; (LHS = 32, INFES = 20 ****)
The only thing missing is the initial marginal value for the row: this can be interesting for some solvers. Similarly, the variable listing shows everything there is to say about a column, including the level value and marginal value. Altogether, each matrix coefficient is listed twice: one in the equation listing, once in the variable listing. Each level (h.L and x.L) is given only once.

Moving from linear to nonlinear, we could write down a proper linearization of a row, e.g.
g.. (16)*(x-2) + 12 =E= 20 ; ( INFES = 8 ****)
But already this is not mathematically correct: it's not enough that the linearization is satisfied. We could fudge that somehow, but that still leaves us repeating the current value of x (2 in this case) for every row involving x. That's very messy if x is not a nice number like 2 but instead something like sqrt(2). So instead of trying to write down a mathematically proper linearization (with some fudge for the =E= and the explicit x-x.L), we maintain the output format of the linear row (except for the parens enclosing the Jacobian entry) to convey all of the information available in the Jacobian of this row while avoiding some unnecessary, repetitive, and distracting output that comes with the proper linearization.

HTH,

-Steve

Post Reply