Scippy

SoPlex

Sequential object-oriented simPlex

spxharrisrt.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-2023 Zuse Institute Berlin (ZIB) */
7 /* */
8 /* Licensed under the Apache License, Version 2.0 (the "License"); */
9 /* you may not use this file except in compliance with the License. */
10 /* You may obtain a copy of the License at */
11 /* */
12 /* http://www.apache.org/licenses/LICENSE-2.0 */
13 /* */
14 /* Unless required by applicable law or agreed to in writing, software */
15 /* distributed under the License is distributed on an "AS IS" BASIS, */
16 /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17 /* See the License for the specific language governing permissions and */
18 /* limitations under the License. */
19 /* */
20 /* You should have received a copy of the Apache-2.0 license */
21 /* along with SoPlex; see the file LICENSE. If not email to soplex@zib.de. */
22 /* */
23 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24 
25 /**@file spxharrisrt.h
26  * @brief Harris pricing with shifting.
27  */
28 #ifndef _SPXHARRISRT_H_
29 #define _SPXHARRISRT_H_
30 
31 #include <assert.h>
32 
33 #include "soplex/spxdefines.h"
34 #include "soplex/spxratiotester.h"
35 
36 namespace soplex
37 {
38 
39 /**@brief Harris pricing with shifting.
40  @ingroup Algo
41 
42  Class SPxHarrisRT is a stable implementation of a SPxRatioTester class
43  along the lines of Harris' two phase algorithm. Additionally it uses
44  shifting of bounds in order to avoid cycling.
45 
46  See SPxRatioTester for a class documentation.
47 */
48 /**@todo HarrisRT leads to cycling in dcmulti.sub.lp */
49 template <class R>
50 class SPxHarrisRT : public SPxRatioTester<R>
51 {
52 private:
53 
54  //-------------------------------------
55  /**@name Private helpers */
56  ///@{
57  ///
58  R degenerateEps() const;
59 
60  ///
61  int maxDelta(
62  R* /*max*/, ///< max abs value in \p upd
63  R* val, ///< initial and chosen value
64  int num, ///< number of indices in \p idx
65  const int* idx, ///< nonzero indices in \p upd
66  const R* upd, ///< update VectorBase<R> for \p vec
67  const R* vec, ///< current vector
68  const R* low, ///< lower bounds for \p vec
69  const R* up ///< upper bounds for \p vec
70  ) const;
71 
72  ///
73  int minDelta(
74  R* /*max*/, ///< max abs value in \p upd
75  R* val, ///< initial and chosen value
76  int num, ///< of indices in \p idx
77  const int* idx, ///< nonzero indices in \p upd
78  const R* upd, ///< update VectorBase<R> for \p vec
79  const R* vec, ///< current vector
80  const R* low, ///< lower bounds for \p vec
81  const R* up ///< upper bounds for \p vec
82  ) const;
83  ///@}
84 
85 public:
86 
87  //-------------------------------------
88  /**@name Construction / destruction */
89  ///@{
90  /// default constructor
92  : SPxRatioTester<R>("Harris")
93  {}
94  /// copy constructor
96  : SPxRatioTester<R>(old)
97  {}
98  /// assignment operator
100  {
101  if(this != &rhs)
102  {
104  }
105 
106  return *this;
107  }
108  /// destructor
109  virtual ~SPxHarrisRT()
110  {}
111  /// clone function for polymorphism
112  inline virtual SPxRatioTester<R>* clone() const
113  {
114  return new SPxHarrisRT(*this);
115  }
116  ///@}
117 
118  //-------------------------------------
119  /**@name Leave / enter */
120  ///@{
121  ///
122  virtual int selectLeave(R& val, R, bool);
123  ///
124  virtual SPxId selectEnter(R& val, int, bool);
125  ///@}
126 
127 };
128 
129 } // namespace soplex
130 // For the general template
131 #include "spxharrisrt.hpp"
132 
133 
134 #endif // _SPXHARRISRT_H_
int maxDelta(R *, R *val, int num, const int *idx, const R *upd, const R *vec, const R *low, const R *up) const
R degenerateEps() const
Abstract ratio test base class.
Abstract ratio test base class.Class SPxRatioTester is the virtual base class for computing the ratio...
Generic Ids for LP rows or columns.Both SPxColIds and SPxRowIds may be treated uniformly as SPxIds: ...
Definition: spxid.h:94
virtual int selectLeave(R &val, R, bool)
virtual ~SPxHarrisRT()
destructor
Definition: spxharrisrt.h:109
SPxHarrisRT & operator=(const SPxHarrisRT &rhs)
assignment operator
Definition: spxharrisrt.h:99
SPxRatioTester & operator=(const SPxRatioTester &rhs)
assignment operator
virtual SPxId selectEnter(R &val, int, bool)
virtual SPxRatioTester< R > * clone() const
clone function for polymorphism
Definition: spxharrisrt.h:112
int minDelta(R *, R *val, int num, const int *idx, const R *upd, const R *vec, const R *low, const R *up) const
Debugging, floating point type and parameter definitions.
Everything should be within this namespace.
SPxHarrisRT()
default constructor
Definition: spxharrisrt.h:91
SPxHarrisRT(const SPxHarrisRT &old)
copy constructor
Definition: spxharrisrt.h:95
Harris pricing with shifting.Class SPxHarrisRT is a stable implementation of a SPxRatioTester class a...
Definition: spxharrisrt.h:50