1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the class library */
4 /* SoPlex --- the Sequential object-oriented simPlex. */
5 /* */
6 /* Copyright (C) 1996-2022 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 #include <assert.h>
17 #include <iostream>
18
19 #include "soplex/spxdefines.h"
(1) Event include_recursion: |
#include file "/sapmnt/home1/d029903/my_work/SCIPSoPlex_coverity/scipoptsuite-8.0.1/soplex/src/soplex/spxvectorst.h" includes itself: spxvectorst.h -> spxvectorst.hpp -> spxvectorst.h |
(2) Event caretline: |
^ |
20 #include "soplex/spxvectorst.h"
21
22 namespace soplex
23 {
24
25 template <class R>
26 void SPxVectorST<R>::setupWeights(SPxSolverBase<R>& base)
27 {
28 if(state == PVEC)
29 {
30 if(vec.dim() != base.nCols())
31 {
32 SPxWeightST<R>::setupWeights(base);
33 return;
34 }
35
36 const VectorBase<R>& obj = base.maxObj();
37 R eps = base.epsilon();
38 R bias = 10000 * eps;
39 R x, y;
40 int i;
41
42 MSG_DEBUG(std::cout << "DVECST01 colWeight[]: ";)
43
44 for(i = base.nCols(); i--;)
45 {
46 x = vec[i] - base.SPxLPBase<R>::lower(i);
47 y = base.SPxLPBase<R>::upper(i) - vec[i];
48
49 if(x < y)
50 {
51 this->colWeight[i] = -x - bias * obj[i];
52 this->colUp[i] = 0;
53 }
54 else
55 {
56 this->colWeight[i] = -y + bias * obj[i];
57 this->colUp[i] = 1;
58 }
59
60 MSG_DEBUG(std::cout << this->colWeight[i] << " ";)
61 }
62
63 MSG_DEBUG(std::cout << std::endl << std::endl;)
64
65 MSG_DEBUG(std::cout << "DVECST02 rowWeight[]: ";)
66
67 for(i = base.nRows(); i--;)
68 {
69 const SVectorBase<R>& row = base.rowVector(i);
70 y = vec * row;
71 x = (y - base.lhs(i));
72 y = (base.rhs(i) - y);
73
74 if(x < y)
75 {
76 this->rowWeight[i] = -x - eps * row.size() - bias * (obj * row);
77 this->rowRight[i] = 0;
78 }
79 else
80 {
81 this->rowWeight[i] = -y - eps * row.size() + bias * (obj * row);
82 this->rowRight[i] = 1;
83 }
84
85 MSG_DEBUG(std::cout << this->rowWeight[i] << " ";)
86 }
87
88 MSG_DEBUG(std::cout << std::endl;)
89 }
90
91 else if(state == DVEC)
92 {
93 if(vec.dim() != base.nRows())
94 {
95 SPxWeightST<R>::setupWeights(base);
96 return;
97 }
98
99 R x, y, len;
100 int i, j;
101
102 for(i = base.nRows(); i--;)
103 this->rowWeight[i] += spxAbs(vec[i]);
104
105 for(i = base.nCols(); i--;)
106 {
107 const SVectorBase<R>& col = base.colVector(i);
108
109 for(y = len = 0, j = col.size(); j--;)
110 {
111 x = col.value(j);
112 y += vec[col.index(j)] * x;
113 len += x * x;
114 }
115
116 if(len > 0)
117 this->colWeight[i] += spxAbs(y / len - base.maxObj(i));
118 }
119 }
120 else
121 SPxWeightST<R>::setupWeights(base);
122 }
123 } // namespace soplex
124