Forum Discussion
FICO
6 years agoCommunity Manager
Mosel: E-101: Incompatible types for operator (`mpvar' *SQUARE* `integer' not defined).
Please note syntax is weird in this post because this forum prohibits special characters. I've thus replaced the arrow/hat/square operator with *SQUARE* throughout my post...
Hi Again! I am hoping I can stop spamming this community with a new question every day, but I've encountered a new one and can't think around it no matter how hard I try. I must be missing something very simple.
In the attached problem, I simply want to minimize the SUM of the SQUARE of my DECISION_VARIABLE * LARGE_CONSTANT. The reason for SQUARE is to incentivize the solver to spread the decision variable around equally. I express this as:
"Min_Panicking:= sum(s in SITE) ((c_min_panic(s) * MIN_PANIC_PENALTY)*SQUARE*2)"
"Max_Panicking:= sum(s in SITE) ((c_max_panic(s) * MAX_PANIC_PENALTY)*SQUARE*2)"
However, this gives error: Mosel: E-101...Incompatible types for operator (`mpvar' *SQUARE* `integer' not defined).
Removing the square 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 User Guide seems to do it:
"! Objective: minimise the total squared distance between all points
TotDist:= sum(i,j in RN | i<j)...*omitted since special characters not allowed*
What am I missing!! Tearing my hair out Thank you...
3 Replies
- FICOCommunity Manager
The example in the Mosel User Guide that your are referring to shows how to formulate a quadratic programming problem with Mosel: you need to load the module 'mmnl' in addition to the solver module 'mmxprs' in order to extend the constraint handling capability of the Mosel language to include quadratic expressions, so
uses "mmxprs", "mmnl"
as shown in the example. Alternatively, you can use the Xpress Nonlinear module:
uses "mmxnlp"
that will automatically select the solver that is best suited for the problem that your are formulating.
- FICOCommunity Manager
Ah, yes, makes sense! I will look into this thank you.
- FICOCommunity Manager
Confirmed :)
Related Content
Related Content
Error 101 Incompatible types for operator ('set of integer' * 'mpvar' not defined)
I'm trying to solve a VRP-model and I receive "Error 101 Incompatible types for operator ('set of integer' * 'mpvar' not defined)" when I try to run, and I have no idea how to solve this. The error is...8 years agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum5 unread comments5 unread0Views0likes5CommentsError 101: Incompatible types in assignment (robustctr := uncertainctr not defined)
I know that this is not possible in its current form, as it fails, but this is what I am trying to do. I am trying to take an uncertain pricing variable (DAUNC) and multiply it by an uncertain load ...5 years agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum1 unread comment1 unread0Views0likes1CommentVariables Defined as Integers Assume Float Values after Optimization
Hello, I am trying to solve a non-linear problem using Xpress-NLP SLP in Python interface. Some variables that I explicitly define to be integers (via myvar = xp.var(..., vartype=xp.integer)), are re...6 years agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum4 unread comments4 unread0Views0likes4Comments