Hello,

My questions regard the code below.

model "non-linear"

uses "mmxprs", "mmnl"

declarations

a1:array(1..10) of mpvar

a2:array(1..10) of real

prod1:array(1..10) of mpvar

sumsq:array(1..10) of nlctr

end-declarations

a2:: [1,2,3,4,5,6,7,8,9,10]

forall(i in 1..10)

if i>1 then

prod1(i):=a1(i)*a2(i)*prod1(i-1)

else

prod1(i):=a1(i)*a2(i)

end-if

forall(i in 1..10) sumsq(i):=(a1(i)+a2(i))^2 <= 2

forall(i in 1..10) a1(i)>=0

sum1:=sum(i in 1..10) prod1(i)*a2(i)

maximize(sum1)

end-model

**Questions:**

** **

1. Compilation error: incompatible types in assignment (the red line). How is it possible?

2. If prod1 is declared as array(1..10) of nlctr, there are no compilation errors. Does such a declaration make sense in the above context?

3. If the type of prod1 is nlctr, the optimization halts with error message: "The current version of XPRESS does not yet support NLP problems with quadratic side constraints." Is there a solution to this problem?

Thank you.

Melania

questions 1+2: The operator ':=' is the assignment operator, that is, you are assigning a nonlinear expression to the model object 'prod1(i)', which is only possible if this object is of the type nlctr ('nonlinear constraint').

If what you really wish to achieve is to define a nonlinear equality constraint, you need to use the operator '=' instead of the assignment with ':='.

The decision on whether to define 'prod1' as array of type 'mpvar' or 'nlctr' really is your choice as the modeler - I would suggest to compare solver performance for both cases.

question 3: with Release 7.5 (or newer) of Xpress please use module "mmxnlp" (and not "mmnl"), with older releases the module "mmxslp" could be used.