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 <iostream>
17
18 #include "soplex/spxdefines.h"
(1) Event include_recursion: |
#include file "/sapmnt/home1/d029903/my_work/SCIPSoPlex_coverity/scipoptsuite-8.0.1/soplex/src/soplex/spxsumst.h" includes itself: spxsumst.h -> spxsumst.hpp -> spxsumst.h |
(2) Event caretline: |
^ |
19 #include "soplex/spxsumst.h"
20 #include "soplex/vector.h"
21
22 namespace soplex
23 {
24
25 template <class R>
26 void SPxSumST<R>::setupWeights(SPxSolverBase<R>& base)
27 {
28 int count;
29 int i;
30 R x;
31 VectorBase<R> work, delta, rowLen;
32
33 assert(base.nRows() > 0);
34 assert(base.nCols() > 0);
35
36 rowLen.reDim(base.nRows(), true);
37 work.reDim(base.nCols(), true);
38 delta.reDim(base.nCols(), true);
39
40 R* wrk = work.get_ptr();
41 const R* lhs = base.lhs().get_const_ptr();
42 const R* rhs = base.rhs().get_const_ptr();
43 const R* up = base.upper().get_const_ptr();
44 const R* low = base.lower().get_const_ptr();
45
46 for(i = base.nRows(); --i >= 0;)
47 {
48 rowLen[i] = base.rowVector(i).length2();
49
50 if(lhs[i] > 0)
51 delta.multAdd(lhs[i] / rowLen[i], base.rowVector(i));
52 else if(rhs[i] < 0)
53 delta.multAdd(rhs[i] / rowLen[i], base.rowVector(i));
54 }
55
56 for(count = 0;; count++)
57 {
58 work += delta;
59
60 for(i = base.nCols(); --i >= 0;)
61 {
62 if(wrk[i] > up[i])
63 wrk[i] = up[i];
64
65 if(wrk[i] < low[i])
66 wrk[i] = low[i];
67 }
68
69 // std::cout << -(work * base.maxObj()) << std::endl;
70 if(count >= 12)
71 break;
72
73 delta.clear();
74
75 for(i = base.nRows(); --i >= 0;)
76 {
77 x = base.rowVector(i) * work;
78
79 if(lhs[i] > x)
80 delta.multAdd((lhs[i] - x) / rowLen[i], base.rowVector(i));
81 else if(rhs[i] < x)
82 delta.multAdd((rhs[i] - x) / rowLen[i], base.rowVector(i));
83 }
84 }
85
86 this->primal(work);
87 SPxVectorST<R>::setupWeights(base);
88 }
89 } // namespace soplex
90