1 | <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?> |
---|
2 | <html xmlns="http://www.w3.org/1999/xhtml"><head><title> |
---|
3 | The 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. The CBC Model Class "/><link rel="previous" href="ch02s02.html" title=" Simple Branch-and-Bound Example "/><link rel="next" href="ch02s04.html" title=" Getting Solution Information "/></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"> |
---|
5 | The 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"/> |
---|
9 | The Relationship Between OSI and CBC |
---|
10 | </h2></div></div><div/></div><p> |
---|
11 | The 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(); |
---|
15 | </pre><p> |
---|
16 | <tt class="classname">CbcModel</tt>'s method <tt class="function">solver()</tt> returns a pointer to CBC's cloned solver. |
---|
17 | </p><p> |
---|
18 | For 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()->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>. |
---|
19 | </p><p> |
---|
20 | While 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()->setHintParam(OsiDoReducePrint,true,OsiHintTry); |
---|
23 | </pre><p> |
---|
24 | |
---|
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> |
---|