source: trunk/Couenne/src/problem/CouenneSolverInterface.hpp @ 103

Last change on this file since 103 was 103, checked in by pbelotti, 11 years ago

fixed bug in zero-multiplicity original variables: they are set to zero in the .sol file, but they shouln't - thanks to Francois Dionne for pointing it out. split CouenneProblem?.cpp to separate constructors and reformulation from the rest. Added two new files for expression containers.

File size: 2.9 KB
Line 
1/*
2 * Name:    CouenneSolverInterface.hpp
3 * Authors: Pietro Belotti, Carnegie Mellon University
4 * Purpose: OsiSolverInterface with a pointer to a CouenneCutGenerator object
5 *
6 * (C) Carnegie-Mellon University, 2007-08.
7 * This file is licensed under the Common Public License (CPL)
8 */
9
10#ifndef COUENNESOLVERINTERFACE_HPP
11#define COUENNESOLVERINTERFACE_HPP
12
13#include "CoinFinite.hpp"
14#include "OsiClpSolverInterface.hpp"
15#include "CouenneCutGenerator.hpp"
16
17class ClpSimplex;
18
19/// Solver interface class with a pointer to a Couenne cut
20/// generator. Its main purposes are:
21///
22/// 1) to apply bound tightening before re-solving
23/// 2) to replace OsiSolverInterface::isInteger () with problem_ -> [expression] -> isInteger ()
24/// 3) to use NLP solution at branching
25 
26class CouenneSolverInterface: public OsiClpSolverInterface {
27
28public:
29
30  /// Constructor
31  CouenneSolverInterface (CouenneCutGenerator *cg = NULL);
32
33  /// Copy constructor
34  CouenneSolverInterface (const CouenneSolverInterface &src);
35
36  /// Destructor
37  ~CouenneSolverInterface ();
38
39  /// Clone
40  virtual OsiSolverInterface * clone (bool copyData = true) const
41  {return new CouenneSolverInterface (*this);}
42
43  /// we need to overwrite this since we might have internal knowledge
44  virtual bool isProvenPrimalInfeasible () const;
45
46  /// we need to overwrite this since we might have internal knowledge
47  virtual bool isProvenOptimal () const;
48
49  /// Return cut generator pointer
50  CouenneCutGenerator *CutGen ()
51  {return cutgen_;}
52
53  /// Set cut generator pointer after setup, to avoid changes in the
54  /// pointer due to cut generator cloning (it happens twice in the
55  /// algorithm)
56  void setCutGenPtr (CouenneCutGenerator *cg)
57  {cutgen_ = cg;}
58
59  /// Solve initial LP relaxation
60  virtual void initialSolve (); 
61
62  /// Resolve an LP relaxation after problem modification
63  virtual void resolve ();
64
65  /// Resolve an LP without applying bound tightening beforehand
66  virtual void resolve_nobt ()
67  {OsiClpSolverInterface::resolve ();}
68
69  /** @name Methods for strong branching.
70   */
71  //@{
72  /// Create a hot start snapshot of the optimization process.
73  virtual void markHotStart();
74
75  /// Optimize starting from the hot start snapshot.
76  virtual void solveFromHotStart();
77
78  /// Delete the hot start snapshot.
79  virtual void unmarkHotStart();
80  //@}
81
82  /// Tighten bounds on all variables (including continuous).
83  virtual int tightenBounds (int lightweight);
84
85  /// Returns pointer to CLP structure.
86  ClpSimplex *continuousModel ()
87  {return continuousModel_;}
88
89private:
90
91  /// The pointer to the Couenne cut generator. Gives us a lot of
92  /// information, for instance the nlp solver pointer, and the chance
93  /// to do bound tightening before resolve ().
94  CouenneCutGenerator *cutgen_;
95
96  /// Flag indicating that infeasibility was detected during solveFromHotStart
97  bool knowInfeasible_;
98
99  /// Flag indicating that optimality was detected during solveFromHotStart
100  bool knowOptimal_;
101};
102
103#endif
Note: See TracBrowser for help on using the repository browser.