source: html/ch06s02.html @ 2172

Last change on this file since 2172 was 561, checked in by ladanyi, 12 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.1 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="ch06.html" title="Chapter 6. &#10;  Advance Solver Uses&#10;"/><link rel="previous" href="ch06.html" title="Chapter 6. &#10;  Advance Solver Uses&#10;"/><link rel="next" href="ch07.html" title="Chapter 7. &#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="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>
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="ch07.html" title="Chapter 7. &#10;More Samples&#10;">Chapter 7, <i>
11More Samples
13  </p><div class="example"><a id="id3186683"/><p class="title"><b>Example 6.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();
31  modelPtr_-&gt;setDualObjectiveLimit(cutoff);
32  if (modelPtr_-&gt;objectiveValue()&gt;cutoff)
33    modelPtr_-&gt;setProblemStatus(1);
34  modelPtr_-&gt;setObjectivePointer(saveObjective);
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. 
39More Samples
Note: See TracBrowser for help on using the repository browser.