source: stable/0.2/Couenne/src/problem/CouenneSolverInterface.hpp @ 159

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

created new stable branch 0.2 from trunk (rev. 157)

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