[557] | 1 | <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?> |
---|
| 2 | <html xmlns="http://www.w3.org/1999/xhtml"><head><title>Quadratic MIP</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.2"/><link rel="home" href="index.html" title="CBC User Guide"/><link rel="up" href="ch06.html" title="Chapter 6. Advance Solver Uses "/><link rel="previous" href="ch06.html" title="Chapter 6. Advance Solver Uses "/><link rel="next" href="ch07.html" title="Chapter 7. More Samples "/></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Quadratic MIP</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch06.html">Prev</a> </td><th width="60%" align="center">Chapter 6. |
---|
| 3 | Advance Solver Uses |
---|
| 4 | </th><td width="20%" align="right"> <a accesskey="n" href="ch07.html">Next</a></td></tr></table><hr/></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="quadratic"/>Quadratic MIP</h2></div></div><div/></div><p> |
---|
| 5 | To give another example - again only for illustrative purposes -- it is possible to do quadratic |
---|
| 6 | MIP with CBC. In this case, we make <tt class="function">resolve</tt> the same as |
---|
| 7 | <tt class="function">initialSolve</tt>. |
---|
| 8 | The full code is in <tt class="filename">ClpQuadInterface.hpp</tt> and |
---|
| 9 | <tt class="filename">ClpQuadInterface.cpp</tt> located in the CBC Samples directory, see |
---|
| 10 | <a href="ch07.html" title="Chapter 7. More Samples ">Chapter 7, <i> |
---|
| 11 | More Samples |
---|
| 12 | </i></a>). |
---|
| 13 | </p><div class="example"><a id="id3186683"/><p class="title"><b>Example 6.5. Solving a Quadratic MIP</b></p><pre class="programlisting"> |
---|
| 14 | |
---|
| 15 | // save cutoff |
---|
| 16 | double cutoff = modelPtr_->dualObjectiveLimit(); |
---|
| 17 | modelPtr_->setDualObjectiveLimit(1.0e50); |
---|
| 18 | modelPtr_->scaling(0); |
---|
| 19 | modelPtr_->setLogLevel(0); |
---|
| 20 | // solve with no objective to get feasible solution |
---|
| 21 | setBasis(basis_,modelPtr_); |
---|
| 22 | modelPtr_->dual(); |
---|
| 23 | basis_ = getBasis(modelPtr_); |
---|
| 24 | modelPtr_->setDualObjectiveLimit(cutoff); |
---|
| 25 | if (modelPtr_->problemStatus()) |
---|
| 26 | return; // problem was infeasible |
---|
| 27 | // Now pass in quadratic objective |
---|
| 28 | ClpObjective * saveObjective = modelPtr_->objectiveAsObject(); |
---|
| 29 | modelPtr_->setObjectivePointer(quadraticObjective_); |
---|
| 30 | modelPtr_->primal(); |
---|
| 31 | modelPtr_->setDualObjectiveLimit(cutoff); |
---|
| 32 | if (modelPtr_->objectiveValue()>cutoff) |
---|
| 33 | modelPtr_->setProblemStatus(1); |
---|
| 34 | modelPtr_->setObjectivePointer(saveObjective); |
---|
| 35 | |
---|
| 36 | </pre></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch06.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch06.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch07.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 6. |
---|
| 37 | Advance Solver Uses |
---|
| 38 | </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 7. |
---|
| 39 | More Samples |
---|
| 40 | </td></tr></table></div></body></html> |
---|