source: html/ch07s02.html

Last change on this file was 561, checked in by ladanyi, 14 years ago

Cbc static pages moved

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
1<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
2<html xmlns=""><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="ch07.html" title="Chapter 7. &#10;  Advanced Solver Uses&#10;"/><link rel="previous" href="ch07.html" title="Chapter 7. &#10;  Advanced Solver Uses&#10;"/><link rel="next" href="ch08.html" title="Chapter 8. &#10;More Samples&#10;"/></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="ch07.html">Prev</a> </td><th width="60%" align="center">Chapter 7. 
3  Advanced Solver Uses
4</th><td width="20%" align="right"> <a accesskey="n" href="ch08.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>
5To give another example - again only for illustrative purposes -- it is possible to do quadratic
6MIP 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="ch08.html" title="Chapter 8. &#10;More Samples&#10;">Chapter 8, <i>
11More Samples
13  </p><div class="example"><a id="id3000974"/><p class="title"><b>Example 7.5. Solving a Quadratic MIP</b></p><pre class="programlisting">
15  // save cutoff
16  double cutoff = modelPtr_-&gt;dualObjectiveLimit();
17  modelPtr_-&gt;setDualObjectiveLimit(1.0e50);
18  modelPtr_-&gt;scaling(0);
19  modelPtr_-&gt;setLogLevel(0);
20  // solve with no objective to get feasible solution
21  setBasis(basis_,modelPtr_);
22  modelPtr_-&gt;dual();
23  basis_ = getBasis(modelPtr_);
24  modelPtr_-&gt;setDualObjectiveLimit(cutoff);
25  if (modelPtr_-&gt;problemStatus())
26    return; // problem was infeasible
27  // Now pass in quadratic objective
28  ClpObjective * saveObjective  = modelPtr_-&gt;objectiveAsObject();
29  modelPtr_-&gt;setObjectivePointer(quadraticObjective_);
30  modelPtr_-&gt;primal(); // Th model has a quadratic objective,
31                       // so this invokes quadratic primal.
32  modelPtr_-&gt;setDualObjectiveLimit(cutoff);
33  if (modelPtr_-&gt;objectiveValue()&gt;cutoff)
34    modelPtr_-&gt;setProblemStatus(1);
35  modelPtr_-&gt;setObjectivePointer(saveObjective);
37  </pre></div><p>
38Rather than implementing all the method from scratch, we based the quadratic solver <tt class="classname">ClpQuadInteface</tt> on the linear programming solver <tt class="classname">OsiClpSolverInterface</tt>. This is a convenient approach to take when prototyping ideas. After the merit of an idea is proven, the user can decide is a more serious implementation is warranted.
39</p></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch07.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch07.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch08.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 7. 
40  Advanced Solver Uses
41 </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 8. 
42More Samples
Note: See TracBrowser for help on using the repository browser.