Scippy

SoPlex

Sequential object-oriented simPlex

spxequilisc.cpp
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-2015 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 spxequilisc.cpp
17  * @brief Equilibrium row/column scaling.
18  */
19 #include <assert.h>
20 
21 #include "spxequilisc.h"
22 #include "spxout.h"
23 
24 namespace soplex
25 {
26 static const char* makename(bool doBoth)
27 {
28  return doBoth ? "bi-Equilibrium" : "uni-Equilibrium";
29 }
30 
32  : SPxScaler(makename(doBoth), false, doBoth)
33 {}
34 
36  : SPxScaler(old)
37 {}
38 
40 {
41  if(this != &rhs)
42  {
44  }
45 
46  return *this;
47 }
48 
49 Real SPxEquiliSC::computeScale(Real /*mini*/, Real maxi) const
50 {
51 
52  return maxi;
53 }
54 
56 {
57 
58  MSG_INFO1( (*spxout), (*spxout) << "Equilibrium scaling LP" << std::endl; )
59 
60  setup(lp);
61 
62  /* We want to do that direction first, with the lower ratio.
63  * Reason:
64  * Rowratio
65  * 0.04 0.02 0.01 4
66  * 4000 20 1000 200
67  * Colratio 1e5 1e3 1e5
68  *
69  * Row first => Col next =>
70  * 1 0.5 0.25 1 1 1
71  * 1 0.05 0.25 1 0.1 1
72  *
73  * Col first => Row next =>
74  * 1e-5 1e-3 1e-5 0.01 1 0.01
75  * 1 1 1 1 1 1
76  *
77  */
78  Real colratio = maxColRatio(lp);
79  Real rowratio = maxRowRatio(lp);
80 
81  bool colFirst = colratio < rowratio;
82 
83  MSG_INFO2( (*spxout), (*spxout) << "LP scaling statistics:"
84  << " min= " << lp.minAbsNzo()
85  << " max= " << lp.maxAbsNzo()
86  << " col-ratio= " << colratio
87  << " row-ratio= " << rowratio
88  << std::endl; )
89  if (colFirst)
90  {
92 
93  if (m_doBoth)
95  }
96  else
97  {
99 
100  if (m_doBoth)
102  }
103  applyScaling(lp);
104 
105  MSG_INFO3( (*spxout), (*spxout) << "Row scaling min= " << minAbsRowscale()
106  << " max= " << maxAbsRowscale()
107  << std::endl
108  << "\tCol scaling min= " << minAbsColscale()
109  << " max= " << maxAbsColscale()
110  << std::endl; )
111 
112  MSG_INFO2( (*spxout), (*spxout) << "LP scaling statistics:"
113  << " min= " << lp.minAbsNzo()
114  << " max= " << lp.maxAbsNzo()
115  << " col-ratio= " << maxColRatio(lp)
116  << " row-ratio= " << maxRowRatio(lp)
117  << std::endl; )
118 }
119 
120 } // namespace soplex