[Scip] Update objective function values and resolve a model

Stefan Vigerske stefan at math.hu-berlin.de
Fri May 20 20:04:21 MEST 2011


Hi,

> Hello SCIP mailinglist!
>
> This time I have what seems to be an easy question. I am modeling a LP problem, which I want to solve with different coefficients. Based on an initial solution I want to solve the problem with the exact same constraints, but new objective function coefficients. I thought it would be possible by a simple call to SCIPchgVarObj, but I get an error stating this is not allowed in the problem stage solved.
>
> What would be the most elegant way to achieve what I want?

After finish solving, do a
  SCIPfreeTransform(scip);
SCIP should then be in the SCIP_STAGE_PROBLEM stage (check with 
SCIPgetStage(scip)) where you can do modification.

Note that by doing SCIPfreeTransform(scip), also all found solutions are 
freed. So you would need to store the solutions values somewhere, then 
free the transformed problem, modify the problem, transform it again, 
pass in the stored solution, solve the modified problem:
1. SCIPgetSolVals(scip, SCIPgetBestSol(scip),
      SCIPgetNOrigVars(scip), SCIPgetOrigVars(scip), myarray)
2. SCIPfreeTransform(scip)
3. modify objective
4. SCIPtransformProb(scip)
5. SCIPcreateSol(scip, &sol, NULL)
    SCIPsetSolVals(scip, sol, SCIPgetNOrigVars(scip), 
SCIPgetOrigVars(scip), myarray)
    SCIPtrySolFree(scip, &sol, ....)
6. SCIPsolve(scip)

Stefan


>
> I can think of three ways to do it (but not necessarily supported by SCIP):
>
>
> 1)      If possible update the coefficients in the objective and resolve the model (the advantage of this should be that a feasible solution is already at hand, name the previous optimal solution). This is supported by CPLEX (which I use at underlaying solver)
>
> 2)      Once the problem is constructed and before calling solve, if possible save this model in some way (don't know if this is support in any manageable way).
>
> 3)      The cumbersome way of making the model all over.
>
> Is any of the options 1 or 2 possible in SCIP?
>
> Have a nice weekend!
>
> Best regards,
>
> Tue R. L. Christensen
> Aarhus University
>
>
>
> --
> The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and privileged material.
>
> Any review, retransmission, dissemination or other use of,or taking of any action in reliance upon, this informationby persons or entities other than the intended recipientis prohibited.
>
> If you received this in error, please contact the sender and delete the material from any computer.
>
>
>
>
> _______________________________________________
> Scip mailing list
> Scip at zib.de
> http://listserv.zib.de/mailman/listinfo/scip


-- 
Stefan Vigerske
Humboldt University Berlin, Numerical Mathematics
http://www.math.hu-berlin.de/~stefan


More information about the Scip mailing list