Toggle navigation
SCIP Optimization Suite
SCIP
SoPlex
ZIMPL
UG
GCG
Documentation
SoPlex 6.0.3
SoPlex 5.0.2
SoPlex 4.0.2
SoPlex 3.1.0
SoPlex 3.0.1
SoPlex 2.2.1
SoPlex
Sequential object-oriented simPlex
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
soplex-repo
src
spxsumst.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
#include <iostream>
17
18
#include "
spxdefines.h
"
19
#include "
spxsumst.h
"
20
#include "
vector.h
"
21
22
namespace
soplex
23
{
24
25
void
SPxSumST::setupWeights
(
SPxSolver
& base)
26
{
27
int
count;
28
int
i;
29
Real
x;
30
DVector
work, delta, rowLen;
31
32
rowLen.
reDim
( base.
nRows
() );
33
work.
reDim
(base.
nCols
());
34
delta.
reDim
(base.
nCols
());
35
36
Real
* wrk = work.
get_ptr
();
37
const
Real
* lhs = base.
lhs
().
get_const_ptr
();
38
const
Real
* rhs = base.
rhs
().
get_const_ptr
();
39
const
Real
* up = base.
upper
().
get_const_ptr
();
40
const
Real
* low = base.
lower
().
get_const_ptr
();
41
42
for
(i = base.
nRows
(); --i >= 0;)
43
{
44
rowLen[i] = base.
rowVector
(i).
length2
();
45
if
(lhs[i] > 0)
46
delta.
multAdd
(lhs[i] / rowLen[i], base.
rowVector
(i));
47
else
if
(rhs[i] < 0)
48
delta.
multAdd
(rhs[i] / rowLen[i], base.
rowVector
(i));
49
}
50
51
for
(count = 0;; count++)
52
{
53
work += delta;
54
for
(i = base.
nCols
(); --i >= 0;)
55
{
56
if
(wrk[i] > up[i])
57
wrk[i] = up[i];
58
if
(wrk[i] < low[i])
59
wrk[i] = low[i];
60
}
61
62
// std::cout << -(work * base.maxObj()) << std::endl;
63
if
(count >= 12)
64
break
;
65
66
delta.
clear
();
67
for
(i = base.
nRows
(); --i >= 0;)
68
{
69
x = base.
rowVector
(i) * work;
70
if
(lhs[i] > x)
71
delta.
multAdd
((lhs[i] - x) / rowLen[i], base.
rowVector
(i));
72
else
if
(rhs[i] < x)
73
delta.
multAdd
((rhs[i] - x) / rowLen[i], base.
rowVector
(i));
74
}
75
}
76
77
primal
(work);
78
SPxVectorST::setupWeights
(base);
79
}
80
}
// namespace soplex