AnsweredAssumed Answered

Handle non linear constraints

Question asked by Melania Calinescu on Apr 23, 2010
Latest reply on Sep 2, 2014 by Susanne.Heip

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

Outcomes