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 namespace abacus {
36 
37 
39 
51 class Row : public SparVec {
52 public:
53 
55 
64  int nnz,
65  const Array<int> &s,
66  const Array<double> &c,
67  const CSense &sense,
68  double r)
69  : SparVec(glob, nnz, s, c), sense_(sense), rhs_(r) { }
70 
72 
81  int nnz,
82  const Array<int> &s,
83  const Array<double> &c,
84  const CSense::SENSE sense,
85  double r)
86  : SparVec(glob, nnz, s, c), sense_(sense), rhs_(r) { }
87 
89 
98  int nnz,
99  int *s,
100  double *c,
102  double r)
103  : SparVec(glob, nnz, s, c), sense_(sense), rhs_(r) { }
104 
106 
110  Row(AbacusGlobal *glob, int size) : SparVec(glob, size) { }
111 
113  ~Row() { }
114 
116 
129  friend std::ostream &operator<<(std::ostream& out, const Row &rhs);
130 
132  double rhs() const { return rhs_; }
133 
135 
138  void rhs(double r) { rhs_ = r; }
139 
141  CSense *sense() { return &sense_; }
142 
144  const CSense *sense() const { return &sense_; }
145 
147 
150  void sense(CSense &s) { sense_ = s; }
151 
153 
156  void sense(CSense::SENSE s) { sense_.sense(s); }
157 
159 
165  void copy(const Row &row);
166 
168 
172  void delInd(ArrayBuffer<int> &buf, double rhsDelta) {
173  leftShift(buf);
174  rhs_ -= rhsDelta;
175  }
176 
177 protected:
178 
180  double rhs_;
181 };
182 
183 
184 }
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:144
abacus::Row::sense
void sense(CSense::SENSE s)
Sets the sense of the row to s.
Definition: row.h:156
abacus::Row::rhs
double rhs() const
Returns the right hand side stored in the row format.
Definition: row.h:132
abacus::Row::sense
CSense * sense()
Returns a pointer to the sense of the row.
Definition: row.h:141
abacus
Definition: ILPClusterPlanarity.h:50
abacus::Row::sense
void sense(CSense &s)
Sets the sense of the row to s.
Definition: row.h:150
abacus::SparVec::nnz
int nnz() const
Returns the number of nonzero elements.
Definition: sparvec.h:232
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:80
abacus::Row::sense_
CSense sense_
The sense of the row.
Definition: row.h:179
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:172
r
int r[]
Definition: hierarchical-ranking.cpp:13
abacus::Row::~Row
~Row()
The destructor.
Definition: row.h:113
abacus::CSense::sense
SENSE sense() const
Returns the sense of the constraint.
Definition: csense.h:97
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:51
abacus::SparVec
Sparse vectors.
Definition: sparvec.h:47
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:97
abacus::SparVec::size
int size() const
Returns the maximal length of the sparse vector.
Definition: sparvec.h:224
sparvec.h
sparse vector.
abacus::Row::rhs_
double rhs_
The right hand side of the row.
Definition: row.h:180
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:48
abacus::Row::rhs
void rhs(double r)
Sets the right hand side of the row to r.
Definition: row.h:138
abacus::AbacusGlobal
Global data and functions.
Definition: global.h:57
abacus::CSense::SENSE
SENSE
Definition: csense.h:51
abacus::Row::Row
Row(AbacusGlobal *glob, int size)
Creates a row without initialization of the nonzeros of the row.
Definition: row.h:110
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:63