Forum Discussion
FICO
14 years agoCommunity Manager
Loading an MIP solution
I'm having trouple loading an existing MIP solution into XPRESS using C++. The documentation for "load MIP solution" has the following example based on C:
XPRBprob expl2;double vals[] = {1.5, 1, 0, 4, 2.2};expl2 = XPRBnewprob("example2");if (XPRBloadmipsol(expl2, vals, 5, 0)!=0) printf("Loading the solution failed.");Here, vals is an array (of size 5) that holds the MIP solution you want to feed in, and expl2 is the name of your problem.
This all seems fine, but I am implementing a similar system in C++, so I have written the following code:
XPRBprob expl2("example2");double vals[] = {1.5, 1, 0, 4, 2.2};if (XPRBloadmipsol(expl2, vals, 5, 0)!=0) cout<<"Loading the solution failed.";However, the XPRBloadmipsol statement does not work. Specifically, I get the following error when I compile:
error C2664: 'xbloadmipsol_prob' : cannot convert parameter 1 from 'class dashoptimization::XPRBprob' to 'struct Xbprob *'This suggests that the paramters for the C++ version of this function are different to the C version. But I cannot find any documentation on this.
Could anyone offer any help?
Thanks
Rhyd
1 Reply
- FICOCommunity Manager
Problem solved.
Here's the c++ code that will work
if(expl2.loadMIPSol(vals, 5, 0)!=0) cout<<"Loading the solution failed.";The fact the "MIP" is in upper-case in the C++ command and lower-case in the C command was not particularly helpful!
Related Content
Related Content
MIP solution status
Hello, I've been using code like this to get the solution status of a MIP: case getprobstat of XPRS_OPT: status:="Optimum found" XPRS_UNF: status:="Unfinished" XPRS_INF: status:="Infeasib...5 months agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum3 unread comments3 unread5Views0likes3CommentsHow to load a MIP solution?
Dear all, Currently, I am trying to provide an initial solution to my IP that has three multidimensional (binary) decision variables (x(N), y(N,M) and z(M)). I know that there are the two functions ...7 years agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum5 unread comments5 unread0Views0likes5CommentsHow can I use ODH for solving a MIP model using Xpress Python API?
Hi everyone, I want to play a bit with ODH for Xpress Solver. I did run ODH from the command line but now I want to integrate it in the whole pipeline of a Python program. What should I import? What...1 month agoPlace FICO® Xpress Optimization ForumFICO® Xpress Optimization Forum2 unread comments2 unread4Views0likes2Comments