SoPlex Doxygen Documentation
lpcol.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the class library */
4 /* SoPlex --- the Sequential object-oriented simPlex. */
5 /* */
6 /* Copyright (C) 1996-2012 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SoPlex is distributed under the terms of the ZIB Academic Licence. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SoPlex; see the file COPYING. If not email to soplex@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file lpcol.h
17  * @brief LP column.
18  */
19 #ifndef _LPCOL_H_
20 #define _LPCOL_H_
21 
22 #include <assert.h>
23 
24 #include "spxdefines.h"
25 #include "dsvector.h"
26 
27 namespace soplex
28 {
29 /**@brief LP column.
30  @ingroup Algo
31 
32  Class LPCol provides a datatype for storing the column of an LP a the
33  form similar to
34  \f[
35  \begin{array}{rl}
36  \hbox{max} & c^T x \\
37  \hbox{s.t.} & Ax \le b \\
38  & l \le x \le u
39  \end{array}
40  \f]
41  Hence, an LPCol consists of an objective value, a column DSVector and
42  an upper and lower bound to the corresponding variable, which may include
43  \f$\pm\infty\f$. However, it depends on the LP code to use, what values are
44  actually treated as \f$\infty\f$.
45  */
46 class LPCol
47 {
48 private:
49 
50  //------------------------------------
51  /**@name Data */
52  //@{
53  Real up; ///< upper bound
54  Real low; ///< lower bound
55  Real object; ///< objective value
56  DSVector vec; ///< the column vector
57  //@}
58 
59 public:
60 
61  //------------------------------------
62  /**@name Construction / destruction */
63  //@{
64  /// default constructor.
65  /** Construct LPCol with a column vector ready for taking \p defDim
66  * nonzeros.
67  */
68  explicit LPCol(int defDim = 0)
69  : up(infinity), low(0), object(0), vec(defDim)
70  {
71  assert(isConsistent());
72  }
73 
74  /// initializing constructor.
75  /* Construct LPCol with the given objective value \p obj, a column
76  * %vector \p vec, upper bound \p upper and lower bound \p lower.
77  */
78  LPCol(Real p_obj, const SVector& p_vector, Real p_upper, Real p_lower)
79  : up(p_upper), low(p_lower), object(p_obj), vec(p_vector)
80  {
81  assert(isConsistent());
82  }
83 
84  /// copy constructor.
85  LPCol(const LPCol& old)
86  : up(old.up), low(old.low), object(old.object), vec(old.vec)
87  {
88  assert(isConsistent());
89  }
90 
91  /// destructor
93  {}
94  //@}
95 
96  //------------------------------------
97  /**@name Access / modification */
98  //@{
99  /// get objective value.
100  Real obj() const
101  {
102  return object;
103  }
104  /// access objective value.
105  void setObj(Real p_object)
106  {
107  object = p_object;
108  }
109 
110  /// get upper bound.
111  Real upper() const
112  {
113  return up;
114  }
115  /// access upper bound.
116  void setUpper(Real p_up)
117  {
118  up = p_up;
119  }
120 
121  /// get lower bound.
122  Real lower() const
123  {
124  return low;
125  }
126  /// access lower bound.
127  void setLower(Real p_low)
128  {
129  low = p_low;
130  }
131 
132  /// get constraint column vector.
133  const SVector& colVector() const
134  {
135  return vec;
136  }
137 
138  /// access constraint column vector.
139  void setColVector(const SVector& p_vec)
140  {
141  vec = p_vec;
142  }
143  //@}
144 
145  //------------------------------------
146  /**@name Consistency check */
147  //@{
148  /// check consistency.
149  bool isConsistent() const
150  {
151 #ifdef ENABLE_CONSISTENCY_CHECKS
152  return vec.isConsistent();
153 #else
154  return true;
155 #endif
156  }
157  //@}
158 };
159 } // namespace soplex
160 #endif // _LPCOL_H_
161 
162 //-----------------------------------------------------------------------------
163 //Emacs Local Variables:
164 //Emacs mode:c++
165 //Emacs c-basic-offset:3
166 //Emacs tab-width:8
167 //Emacs indent-tabs-mode:nil
168 //Emacs End:
169 //-----------------------------------------------------------------------------