Forum Discussion
FICO
6 years agoCommunity Manager
Variables 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 resulting as real numbers upon p.solve.
The optimization is throwing me some unconverged items and the message "Converged solution is outside feasibility tolerance" in the console, so the issue is likely related to these. I know there is a feasible solution to this problem, likely with a worse objective value. Is there are better way to approach this problem ensuring it respects vartype=xp.integer constraint?
Addition: I removed some constraints, and now I get 0 unconverged items on console with "Converged on objective function with some variables converged on extended criteria only." message. However, I'm still getting float values for those integer defined variables.
4 Replies
- FICOCommunity Manager
Hello. Are these real numbers far from being integer, or are they close to integrality?
It would help us understand your problem if you could share more details about the problem (perhaps the script) and the version of the Python interface you are using.
Thanks,
Pietro
- FICOCommunity Manager
Also, can you say what is the value of p.attributes.xslp_nlpstatus, where p is the problem object?
- FICOCommunity Manager
Hi Pietro,
Thank you very much for your comments. Let me answer your questions. These numbers are far from being integers. I am using the latest version of Python interface (v8.8.2). I am getting output 3 when I run attributes.xslp_nlpstatus.
I'm attaching a pseudocode of my problem involving the coefficients that take continuous values. var1 are assuming continuous variables in this case. Please let me know if this is not enough and you think more details would be helpful. Thanks.
- FICOCommunity Manager
Hello. The value 3 of xslp_nlpstatus is equivalent to nlp_locally_infeasible (try checking p.attributes.xslp_nlpstatus == xpress.nlp_locally_infeasible). This happens when the problem cannot be declared globally infeasible (i.e. there is no guarantee that the problem has no solution) but the search could not find any feasible solution.
The solution you obtained and reported in this thread is therefore unreliable. I tried running your code (with some added declarations) and indeed the result was xslp_nlpstatus == 3. The current poing indeed cannot be taken as feasible for any constraint, including integrality constraints.

