Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

row.h
Go to the documentation of this file.
1 
30 #pragma once
31 
33 #include <ogdf/lib/abacus/csense.h>
34 
35 #pragma GCC visibility push(default)
36 namespace abacus {
37 
38 
40 
52 class Row : public SparVec {
53 public:
54 
56 
65  int nnz,
66  const Array<int> &s,
67  const Array<double> &c,
68  const CSense &sense,
69  double r)
70  : SparVec(glob, nnz, s, c), sense_(sense), rhs_(r) { }
71 
73 
82  int nnz,
83  const Array<int> &s,
84  const Array<double> &c,
85  const CSense::SENSE sense,
86  double r)
87  : SparVec(glob, nnz, s, c), sense_(sense), rhs_(r) { }
88 
90 
99  int nnz,
100  int *s,
101  double *c,
103  double r)
104  : SparVec(glob, nnz, s, c), sense_(sense), rhs_(r) { }
105 
107 
111  Row(AbacusGlobal *glob, int size) : SparVec(glob, size) { }
112 
114  ~Row() { }
115 
117 
130  friend std::ostream &operator<<(std::ostream& out, const Row &rhs);
131 
133  double rhs() const { return rhs_; }
134 
136 
139  void rhs(double r) { rhs_ = r; }
140 
142  CSense *sense() { return &sense_; }
143 
145  const CSense *sense() const { return &sense_; }
146 
148 
151  void sense(CSense &s) { sense_ = s; }
152 
154 
157  void sense(CSense::SENSE s) { sense_.sense(s); }
158 
160 
166  void copy(const Row &row);
167 
169 
173  void delInd(ArrayBuffer<int> &buf, double rhsDelta) {
174  leftShift(buf);
175  rhs_ -= rhsDelta;
176  }
177 
178 protected:
179 
181  double rhs_;
182 };
183 
184 
185 }
186 #pragma GCC visibility pop
ogdf::ArrayBuffer
An array that keeps track of the number of inserted elements; also usable as an efficient stack.
Definition: Array.h:53
abacus::Row::sense
const CSense * sense() const
Returns a const pointer to the sense of the row.
Definition: row.h:145
abacus::Row::sense
void sense(CSense::SENSE s)
Sets the sense of the row to s.
Definition: row.h:157
abacus::Row::rhs
double rhs() const
Returns the right hand side stored in the row format.
Definition: row.h:133
abacus::Row::sense
CSense * sense()
Returns a pointer to the sense of the row.
Definition: row.h:142
abacus
Definition: ILPClusterPlanarity.h:50
abacus::Row::sense
void sense(CSense &s)
Sets the sense of the row to s.
Definition: row.h:151
abacus::SparVec::nnz
int nnz() const
Returns the number of nonzero elements.
Definition: sparvec.h:233
abacus::Row::copy
void copy(const Row &row)
Copies row.
abacus::Row::Row
Row(AbacusGlobal *glob, int nnz, const Array< int > &s, const Array< double > &c, const CSense::SENSE sense, double r)
Creates a row and initializes it.
Definition: row.h:81
abacus::Row::sense_
CSense sense_
The sense of the row.
Definition: row.h:180
abacus::Row::delInd
void delInd(ArrayBuffer< int > &buf, double rhsDelta)
Removes the indices listed in buf from the support of the row and subtracts rhsDelta from its right h...
Definition: row.h:173
r
int r[]
Definition: hierarchical-ranking.cpp:13
abacus::Row::~Row
~Row()
The destructor.
Definition: row.h:114
abacus::CSense::sense
SENSE sense() const
Returns the sense of the constraint.
Definition: csense.h:98
ogdf::Array
The parameterized class Array implements dynamic arrays of type E.
Definition: Array.h:219
abacus::Row
Representation of constraints in the row format.
Definition: row.h:52
abacus::SparVec
Sparse vectors.
Definition: sparvec.h:48
csense.h
csense.
abacus::Row::Row
Row(AbacusGlobal *glob, int nnz, int *s, double *c, CSense::SENSE sense, double r)
Creates a row and initializes it using C-style arrays.
Definition: row.h:98
abacus::SparVec::size
int size() const
Returns the maximal length of the sparse vector.
Definition: sparvec.h:225
sparvec.h
sparse vector.
abacus::Row::rhs_
double rhs_
The right hand side of the row.
Definition: row.h:181
abacus::Row::operator<<
friend std::ostream & operator<<(std::ostream &out, const Row &rhs)
The output operator.
abacus::SparVec::leftShift
void leftShift(ArrayBuffer< int > &del)
Deletes the elements listed in a buffer from the sparse vector.
abacus::CSense
Sense of constraints.
Definition: csense.h:49
abacus::Row::rhs
void rhs(double r)
Sets the right hand side of the row to r.
Definition: row.h:139
abacus::AbacusGlobal
Global data and functions.
Definition: global.h:58
abacus::CSense::SENSE
SENSE
Definition: csense.h:52
abacus::Row::Row
Row(AbacusGlobal *glob, int size)
Creates a row without initialization of the nonzeros of the row.
Definition: row.h:111
abacus::Row::Row
Row(AbacusGlobal *glob, int nnz, const Array< int > &s, const Array< double > &c, const CSense &sense, double r)
Creates a row and initializes it.
Definition: row.h:64