source: html/trunk/Clp/userguide/ch02s08.html @ 956

Last change on this file since 956 was 956, checked in by ddelanu, 16 years ago

First revision of user guide

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>
2  Presolve
3  </title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="CLP User Manual"><link rel="up" href="ch02.html" title="Chapter 2. 
4  Basic Model Classes
5  "><link rel="previous" href="ch02s07.html" title="
6  Simplex-specific Methods
7  "><link rel="next" href="ch02s09.html" title="Status Array"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">
8  Presolve
9  </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s07.html">Prev</a> </td><th width="60%" align="center">Chapter 2. 
10  Basic Model Classes
11  </th><td width="20%" align="right"> <a accesskey="n" href="ch02s09.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 name="presolve"></a>
12  Presolve
13  </h2></div></div><div></div></div><p>
14  The header file for the use of CLP's presolve functionality is
15  <tt class="filename">COIN/Clp/include/Presolve.hpp</tt>.  The sample program below
16  illustrates some of the possibilities offered by CLP's presolve:
17  </p><div class="example"><a name="presolveexample"></a><p class="title"><b>Example 2.3. Presolve code fragment</b></p><pre class="programlisting">
18#include "ClpSimplex.hpp"
19#include "ClpPresolve.hpp"
20int main (int argc, const char *argv[])
21{
22  ClpSimplex model;
23  model.readMps("../../Mps/Sample/p0033.mps"); // initialized by readMps or whatever
24  ClpPresolve presolveInfo;
25  ClpSimplex * presolvedModel = presolveInfo.presolvedModel(model);
26  // at this point we have original model and a new model.  The  information
27  // on the operations done is in presolveInfo
28  if (presolvedModel) {
29    // was not found to be infeasible - so lets solve
30    // if presolvedModel was NULL then it was primal infeasible and ...
31    presolvedModel-&gt;dual(); // or whatever else we wish to do
32    presolveInfo.postsolve(true);  // the true updates status arrays in original       
33    /* If the presolved model was optimal then so should the
34       original be.           
35       We can use checkSolution and test feasibility */
36    model.checkSolution();         
37    if (model.numberDualInfeasibilities()||
38        model.numberPrimalInfeasibilities())
39      printf("%g dual %g(%d) Primal %g(%d)\n",
40             model.objectiveValue(),
41             model.sumDualInfeasibilities(),
42             model.numberDualInfeasibilities(),
43             model.sumPrimalInfeasibilities(),
44             model.numberPrimalInfeasibilities());
45    // Due to tolerances we can not guarantee that so you may wish to throw in
46    model.primal(1);
47  }
48}   
49  </pre></div><p>
50  Presolve has a few more options which can be found in the header file, for
51  example whether to treat as an integer problem or whether to keep row and
52  column names.
53  </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s07.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="ch02s09.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">
54  Simplex-specific Methods
55   </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Status Array</td></tr></table></div></body></html>
Note: See TracBrowser for help on using the repository browser.