in my problem, I want to minimize the sum of the square of a decision variable * LARGE_CONSTANT. The reason for square is to incentivize the solver to spread the decision variable around equally; if I have to use the panic variables, I want to use them equally across the set of locations.
Some code (admittedly not enough to reproduce), follows:
declarations
SITE: set of string
c_min_panic: array(SITE) of mpvar
c_max_panic: array(SITE) of mpvar
end-declarations
! Objectives.
Min_Panicking:= sum(s in SITE) ((c_min_panic(s) * 10000)^2)
Max_Panicking:= sum(s in SITE) ((c_max_panic(s) * 10000)^2)
However, this gives error: Mosel: E-101...Incompatible types for operator (mpvar' ^
integer' not defined).
Removing the ^ makes the problem work fine.
I am shocked why I can't square this? In fact, I see examples in the documentation that look like successful attempts to square the objective function. For example, Page 186 of the FICO Xpress User Guide seems to do it:
! Objective: minimise the total squared distance between all points
TotDist:= sum(i,j in RN | i<j) ((x(i)-x(j))^2+(y(i)-y(j))^2
What am I missing!! Tearing my hair out Thank you...