Originally posted by: SystemAdmin
>
> Dear Experts,
... and others ... :-)
>
> I've just recently started using CPLEX 8.1
You should seriously consider upgrading to 12.2. It's orders of magnitude faster on MIPs.
> and basically what I'm trying to do is the following.
>
> Read LP file
> while (objective value < target value) {
Hopefully you are minimizing; otherwise this will be an infinite loop.
> mipopt()
> get solution (getmipx(), getmipobjval(), etc)
> add a row using the solution
> }
> write LP file
>
> I have managed to read the LP file and optimize and get the objective value and solution. The problem I have is with using the solution to add row. When I use the CPXaddrows() command, the row is added (I checked this by having it write to LP file after the function). But when I use the mipopt() command again it doesn't work resulting in segmentation fault.
As far as I can see, this approach should work. Try using CPXcheckaddrows to verify that the arguments to CPXaddrows are correct (so that you're not adding a null row or something) -- although the LP file printing correctly ought to eliminate most mistakes.
> I then tried CPXadduserscut() command and again the constraint was added but this time mipopt() just provide the same solution which resulting in the while loop looping forever.
You're certain that the cut you are adding cuts off the previous solution? And did you turn off CPX_PARAM_PRELINEAR?
> Could you please provide me with suggestions here. After I add the cut do I need to do anything with CPXsetintparam() or any other settings? what I did was add cut then opt right away.
No, you should be able to add a constraint and then reoptimize without any other manipulations.
Paul
Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
#CPLEXOptimizers#DecisionOptimization