Scippy

SoPlex

Sequential object-oriented simPlex

spxvectorst.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-2019 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 spxvectorst.h
17  * @brief Solution vector based start basis.
18  */
19 #ifndef _SPXVECTORST_H_
20 #define _SPXVECTORST_H_
21 
22 #include <assert.h>
23 
24 #include "soplex/spxweightst.h"
25 #include "soplex/vector.h"
26 
27 namespace soplex
28 {
29 
30 /**@brief Solution vector based start basis.
31  @ingroup Algo
32 
33  This version of SPxWeightST can be used to construct a starting basis for
34  an LP to be solved with SoPlex if an approximate solution vector or dual
35  vector (possibly optained by a heuristic) is available. This is done by
36  setting up weights for the SPxWeightST it is derived from.
37 
38  The primal vector to be used is loaded by calling method #primal() while
39  #dual() setups for the dual vector. Methods #primal() or #dual() must be
40  called \em before #generate() is called by SoPlex to set up a
41  starting basis. If more than one call of method #primal() or #dual()
42  occurred only the most recent one is valid for generating the starting base.
43 */
44 class SPxVectorST : public SPxWeightST
45 {
46 private:
47 
48  //-------------------------------------
49  /**@name Types */
50  //@{
51  /// specifies whether to work on the primal, the dual, or not at all.
52  enum { NONE, PVEC, DVEC } state;
53  //@}
54 
55  //-------------------------------------
56  /**@name Data */
57  //@{
58  /// the current (approximate) primal or dual vector
60  //@}
61 
62 protected:
63 
64  //-------------------------------------
65  /**@name Protected helpers */
66  //@{
67  /// sets up variable weights.
68  void setupWeights(SPxSolver& base);
69  //@}
70 
71 public:
72 
73  //-------------------------------------
74  /**@name Construction / destruction */
75  //@{
76  /// default constructor.
78  : state(NONE)
79  {
80  m_name = "Vector";
81  }
82  /// copy constructor
84  : SPxWeightST(old)
85  , state(old.state)
86  , vec(old.vec)
87  {
88  assert(isConsistent());
89  }
90  /// assignment operator
92  {
93  if(this != &rhs)
94  {
96  state = rhs.state;
97  vec = rhs.vec;
98 
99  assert(isConsistent());
100  }
101 
102  return *this;
103  }
104  /// destructor.
105  virtual ~SPxVectorST()
106  {}
107  /// clone function for polymorphism
108  inline virtual SPxStarter* clone() const
109  {
110  return new SPxVectorST(*this);
111  }
112  //@}
113 
114  //-------------------------------------
115  /**@name Modification */
116  //@{
117  /// sets up primal solution vector.
118  void primal(const Vector& v)
119  {
120  vec = v;
121  state = PVEC;
122  }
123  /// sets up primal solution vector.
124  void dual(const Vector& v)
125  {
126  vec = v;
127  state = DVEC;
128  }
129  //@}
130 
131 };
132 
133 } // namespace soplex
134 #endif // _SPXVECTORST_H_
virtual ~SPxVectorST()
destructor.
Definition: spxvectorst.h:105
SoPlex start basis generation base class.SPxStarter is the virtual base class for classes generating ...
Definition: spxstarter.h:41
const char * m_name
name of the starter
Definition: spxstarter.h:49
Dense vector for linear algebra.
SPxVectorST(const SPxVectorST &old)
copy constructor
Definition: spxvectorst.h:83
void dual(const Vector &v)
sets up primal solution vector.
Definition: spxvectorst.h:124
void setupWeights(SPxSolver &base)
sets up variable weights.
Definition: spxvectorst.cpp:25
DVector vec
the current (approximate) primal or dual vector
Definition: spxvectorst.h:59
Solution vector based start basis.This version of SPxWeightST can be used to construct a starting bas...
Definition: spxvectorst.h:44
enum soplex::SPxVectorST::@1 state
specifies whether to work on the primal, the dual, or not at all.
Sequential object-oriented SimPlex.SPxSolver is an LP solver class using the revised Simplex algorith...
Definition: spxsolver.h:85
Everything should be within this namespace.
SPxVectorST()
default constructor.
Definition: spxvectorst.h:77
Weighted start basis.
virtual SPxStarter * clone() const
clone function for polymorphism
Definition: spxvectorst.h:108
Weighted start basis.Class SPxWeightST is an implementation of a SPxStarter for generating a Simplex ...
Definition: spxweightst.h:56
void primal(const Vector &v)
sets up primal solution vector.
Definition: spxvectorst.h:118
SPxVectorST & operator=(const SPxVectorST &rhs)
assignment operator
Definition: spxvectorst.h:91
SPxWeightST & operator=(const SPxWeightST &rhs)
assignment operator
Definition: spxweightst.h:145
virtual bool isConsistent() const
consistency check.
Definition: spxweightst.cpp:31