source: html/ch02s03.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: 4.1 KB
1<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
2<html xmlns=""><head><title>
3The Relationship Between OSI and CBC
4</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="ch02.html" title="Chapter 2. &#10;   The CBC Model Class&#10;  "/><link rel="previous" href="ch02s02.html" title="&#10;  Simple Branch-and-Bound Example&#10;  "/><link rel="next" href="ch02s04.html" title="&#10;  Getting Solution Information&#10;  "/></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">
5The Relationship Between OSI and CBC
6</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s02.html">Prev</a> </td><th width="60%" align="center">Chapter 2. 
7   The CBC Model Class
8  </th><td width="20%" align="right"> <a accesskey="n" href="ch02s04.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="osiAndCbc"/>
9The Relationship Between OSI and CBC
11The program in <a href="ch02s02.html#minimum.cpp" title="Example 2.1. minimum.cpp">Example 2.1</a> illustrates the dependency of CBC on 
12  the <tt class="classname">OsiSolverInterface</tt> class. The constructor of <tt class="classname">CbcModel</tt> takes a pointer to an <tt class="classname">OsiSolverInterface</tt> (i.e., a solver). The <tt class="classname">CbcModel</tt> clones the solver, and uses its own instance of the solver. The <tt class="classname">CbcModel</tt>'s solver and the original solver (e.g., <tt class="varname">solver1</tt>) are not in sync unless the user synchronizes them. The user can always access the <tt class="classname">CbcModel</tt>'s solver through the <tt class="function">model()</tt> class.  To synchronize the two solvers, explicitly refreshing the original, e.g., 
13 </p><pre class="programlisting">
14  solver1 = model.solver();
16<tt class="classname">CbcModel</tt>'s method <tt class="function">solver()</tt> returns a pointer to CBC's cloned solver.
18For convenience, many of the OSI methods to access problem data have identical method names in  <tt class="classname">CbcModel</tt>. (It's just more convenient to type <tt class="function">model.getNumCols()</tt> rather than <tt class="function">model.solver()-&gt;getNumCols()</tt>). The <tt class="classname">CbcModel</tt> refreshes its solver at certain logical points during the algorithm. At these points, the information from the <tt class="classname">CbcModel</tt> <tt class="varname">model</tt> will match the information from the <tt class="function">model.solver()</tt>. Elsewhere, the information may vary. For instance, the method <tt class="function">CbcModel::bestSolution()</tt> will contain the best solution so far, the OSI method <tt class="function">getColSolution()</tt> may not. In this case, it is safer to use <tt class="function">CbcModel::bestSolution()</tt>.
20While all the OSI methods used in <tt class="filename">minimum.cpp</tt> have equivalent methods in <tt class="classname">CbcModel</tt>, there are some OSI methods which do not. For example, if  the program produced a lot of undesired output, one might add the line
21</p><pre class="programlisting">
22  model.solver()-&gt;setHintParam(OsiDoReducePrint,true,OsiHintTry);
25  to reduce the output. There is no <tt class="function">setHintParam()</tt> method in <tt class="classname">CbcModel</tt>.
26  </p></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s02.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">
27  Simple Branch-and-Bound Example
28   </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 
29  Getting Solution Information
30  </td></tr></table></div></body></html>
Note: See TracBrowser for help on using the repository browser.