source: stable/0.2/Couenne/src/branch/CouenneSOSObject.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.5 KB
Line 
1/* $Id: CouenneSOSObject.hpp 141 2009-06-03 04:19:19Z pbelotti $ */
2/*
3 * Name:    CouenneSOSObject.hpp
4 * Authors: Pietro Belotti, Lehigh University
5 * Purpose: SOS Object
6 *
7 * (C) Carnegie-Mellon University, 2008.
8 * This file is licensed under the Common Public License (CPL)
9 */
10
11#ifndef COUENNESOSOBJECT_HPP
12#define COUENNESOSOBJECT_HPP
13
14#include "OsiBranchingObject.hpp"
15#include "exprVar.hpp"
16
17class CouenneSOSObject;
18
19// TODO: SOS of the form sum x_i \le k with k small. Instead of
20// branching on a single variable do a SOS-like branching
21
22class CouenneSOSBranchingObject: public OsiSOSBranchingObject {
23
24protected:
25
26  /// pointer to Couenne problem
27  CouenneProblem *problem_;
28
29  /// The (auxiliary) variable this branching object refers to. If the
30  /// expression is w=f(x,y), this is w, as opposed to
31  /// CouenneBranchingObject, where it would be either x or y.
32  exprVar *reference_;
33
34  /// SmartPointer to the Journalist
35  JnlstPtr jnlst_;
36
37  /// shall we do Feasibility based Bound Tightening (FBBT) at branching?
38  bool doFBBT_;
39
40  /// shall we add convexification cuts at branching?
41  bool doConvCuts_;
42
43public:
44
45  // Default Constructor
46  CouenneSOSBranchingObject () {}
47
48  // Useful constructor
49  CouenneSOSBranchingObject (OsiSolverInterface *solver, 
50                             const OsiSOS *originalObject,
51                             int way, 
52                             double separator,
53                             JnlstPtr jnlst,
54                             bool doFBBT,
55                             bool doConvCuts):
56
57    OsiSOSBranchingObject (solver, originalObject, way, separator),
58    //reference_ (ref),
59    jnlst_ (jnlst),
60    doFBBT_ (doFBBT),
61    doConvCuts_ (doConvCuts) {}
62
63 
64  // Copy constructor
65  CouenneSOSBranchingObject (const CouenneSOSBranchingObject &src):
66    OsiSOSBranchingObject (src),
67    //reference_ (ref),
68    jnlst_      (src.jnlst_),
69    doFBBT_     (src.doFBBT_),
70    doConvCuts_ (src.doConvCuts_) {}
71
72   
73  /// Clone
74  virtual OsiBranchingObject * clone() const
75  {return new CouenneSOSBranchingObject (*this);}
76
77  /// Does next branch and updates state
78  virtual double branch (OsiSolverInterface * solver);
79};
80
81
82///
83///
84///
85
86class CouenneSOSObject: public OsiSOS {
87
88protected:
89
90  /// The (auxiliary) variable this branching object refers to. If the
91  /// expression is w=f(x,y), this is w, as opposed to
92  /// CouenneBranchingObject, where it would be either x or y.
93  //exprVar *reference_;
94
95  /// SmartPointer to the Journalist
96  JnlstPtr jnlst_;
97
98  /// shall we do Feasibility based Bound Tightening (FBBT) at branching?
99  bool doFBBT_;
100
101  /// shall we add convexification cuts at branching?
102  bool doConvCuts_;
103
104public:
105
106  CouenneSOSObject (OsiSolverInterface *solver, int nelem, int *indices, double *weights, int type,
107                    //CouenneProblem *problem,
108                    //exprVar *ref,
109                    JnlstPtr jnlst,
110                    bool doFBBT,
111                    bool doConvCuts):
112
113    OsiSOS      (solver, nelem, indices, weights, type),
114    //problem_    (problem),
115    //reference_  (ref),
116    jnlst_      (jnlst),
117    doFBBT_     (doFBBT),
118    doConvCuts_ (doConvCuts) {}
119
120
121  /// Copy constructor
122  CouenneSOSObject (const CouenneSOSObject &src):
123    OsiSOS      (src),
124    //problem_    (src.problem_),
125    //reference_  (src.reference_),
126    jnlst_      (src.jnlst_),
127    doFBBT_     (src.doFBBT_),
128    doConvCuts_ (src.doConvCuts_) {}
129   
130  /// Cloning method
131  virtual OsiObject * clone () const
132  {return new CouenneSOSObject (*this);}
133
134  /// create branching objects
135  OsiBranchingObject *createBranch (OsiSolverInterface* si, 
136                                    const OsiBranchingInformation* info, int way) const;
137
138  /// return reference auxiliary variable
139  //exprVar *Reference () const
140  //{return reference_;}
141};
142
143#endif
Note: See TracBrowser for help on using the repository browser.