Hello everyone! I have values as integer array x[i][j], y[i]. These values are obtained using a heuristic algorithm now, I want to pass these values to CPLEX as start solution using these values. I using addMIPStart() method for this.After reading the related problem https://www.or-exchange.org/questions/8191/addmipstart-problem,I learn about some information ,but there still some errors. My approach is as: I defined IloIntArray tstart(env); IloIntArray2 xstart(env); IloIntArray xstartyiwei(env);//Turn 2D xstart to 1D xstartyiwei and similarly IIloArray<iloboolvararray> X(env, TotalNode); IloNumVarArray Xyiwei(env, TotalNodeTotalNode, 0, 1) ////Turn 2D X to 1D Xyiwei IloIntVarArray t(env, TotalNode, 0, Tteam); (and also defined memory for both of these arrays). Then I stored the values of x[i][j], y[i] in xstart(env),tstart(env) Now I am calling addMipStart as follows: cplex.exportModel("model.lp"); IloNumVarArray startVar(env); IloNumArray startVal(env); for (int i = 0; i < TotalNodeTotalNode; i++) { startVar.add(Xyiwei[i]); startVal.add(xstartyiwei[i]);

    }
    for (int i = 0; i < TotalNode; i++)
    {
        startVar.add(t[i]);
        startVal.add(tstart[i]);

    }       
    IloCplex::MIPStartEffort effort = IloCplex::MIPStartEffort::MIPStartAuto;
    cplex.addMIPStart(startVar, startVal, effort, "startsolusion.mst");     
    cplex.readMIPStarts("startsolusion.mst");
    cplex.solve();      
    startVal.end();
    startVar.end();
when it turn to the statement"cplex.addMIPStart(startVar, startVal, effort, "startsolusion.mst");   ",it gives me the error"Error: IloExtractable 1 IloNumVarI has not been extracted by IloAlgorithm 0000028CD910E0D0";But if I Comment out this statement:

"for (int i = 0; i < TotalNode*TotalNode; i++) { startVar.add(Xyiwei[i]); startVal.add(xstartyiwei[i]);

    }"
there are not the error.
However,another error will be when it turns to "cplex.readMIPStarts("startsolusion.mst");"
Actually,there are not a startsolusion.mst file accur after the ststement "cplex.addMIPStart(startVar, startVal, effort, "startsolusion.mst");"
So,I think the last two parameters "effort",and "startsolusion.mst" in "cplex.addMIPStart(startVar, startVal, effort, "startsolusion.mst");" are not true.
My English is poor,please bear with me.I want to learn more about cplex.readMIPStarts.

asked 16 Apr, 10:45

Jun's gravatar image

Jun
111
accept rate: 0%

closed 17 Apr, 11:36

Paul%20Rubin's gravatar image

Paul Rubin ♦♦
14.5k412

The question has been closed for the following reason "Duplicate Question" by Paul Rubin 17 Apr, 11:36

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×192

Asked: 16 Apr, 10:45

Seen: 39 times

Last updated: 17 Apr, 11:36

OR-Exchange! Your site for questions, answers, and announcements about operations research.