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
91   	   SPxHarrisRT()
92   	      : SPxRatioTester<R>("Harris")
93   	   {}
94   	   /// copy constructor
95   	   SPxHarrisRT(const SPxHarrisRT& old)
96   	      : SPxRatioTester<R>(old)
97   	   {}
98   	   /// assignment operator
99   	   SPxHarrisRT& operator=(const SPxHarrisRT& rhs)
100  	   {
101  	      if(this != &rhs)
102  	      {
103  	         SPxRatioTester<R>::operator=(rhs);
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_
135