Scippy

SoPlex

Sequential object-oriented simPlex

lpcolsetbase.h
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-2017 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 /**@file lpcolsetbase.h
17  * @brief Set of LP columns.
18  */
19 #ifndef _LPCOLSETBASE_H_
20 #define _LPCOLSETBASE_H_
21 
22 #include <assert.h>
23 
24 #include "spxdefines.h"
25 #include "basevectors.h"
26 #include "datakey.h"
27 #include "lpcolbase.h"
28 
29 namespace soplex
30 {
31 /**@brief Set of LP columns.
32  * @ingroup Algebra
33  *
34  * Class LPColSetBase implements a set of \ref LPColBase "LPColBase%s". Unless for memory limitations, any number of LPColBase%s may be
35  * #add%ed to an LPColSetBase. Single or multiple LPColBase%s may be #add%ed to an LPColSetBase, where each method add() comes with
36  * two different signatures. One with and one without a parameter, used for returning the \ref DataKey "DataKeys"
37  * assigned to the new LPColBase%s by the set. See DataKey for a more detailed description of the concept of keys. For the
38  * concept of renumbering LPColBase%s within an LPColSetBase after removal of some LPColBase%s, see DataSet.
39  *
40  * @see DataSet, DataKey
41  */
42 template < class R >
43 class LPColSetBase : protected SVSetBase<R>
44 {
45  template < class S > friend class LPColSetBase;
46 
47 private:
48 
49  // ------------------------------------------------------------------------------------------------------------------
50  /**@name Data */
51  //@{
52 
53  DVectorBase<R> low; ///< vector of lower bounds.
54  DVectorBase<R> up; ///< vector of upper bounds.
55  DVectorBase<R> object; ///< vector of objective coefficients.
56 
57  //@}
58 
59 protected:
60 
61  DataArray < int > scaleExp; ///< column scaling factors (stored as bitshift)
62 
63  // ------------------------------------------------------------------------------------------------------------------
64  /**@name Protected helpers */
65  //@{
66 
67  /// Returns the complete SVSetBase.
68  const SVSetBase<R>* colSet() const
69  {
70  return this;
71  }
72 
73  //@}
74 
75 public:
76 
77  // ------------------------------------------------------------------------------------------------------------------
78  /**@name Inquiry */
79  //@{
80 
81  /// Returns the number of LPColBase%s currently in LPColSetBase.
82  int num() const
83  {
84  return SVSetBase<R>::num();
85  }
86 
87  /// Returns maximum number of LPColBase%s currently fitting into LPColSetBase.
88  int max() const
89  {
90  return SVSetBase<R>::max();
91  }
92 
93  ///
94  const VectorBase<R>& maxObj() const
95  {
96  return object;
97  }
98 
99  /// Returns vector of objective values w.r.t. maximization.
101  {
102  return object;
103  }
104 
105  ///
106  const R& maxObj(int i) const
107  {
108  return object[i];
109  }
110 
111  /// Returns objective value (w.r.t. maximization) of \p i 'th LPColBase in LPColSetBase.
112  R& maxObj_w(int i)
113  {
114  return object[i];
115  }
116 
117  ///
118  const R& maxObj(const DataKey& k) const
119  {
120  return object[number(k)];
121  }
122 
123  /// Returns objective value (w.r.t. maximization) of LPColBase with DataKey \p k in LPColSetBase.
124  R& maxObj_w(const DataKey& k)
125  {
126  return object[number(k)];
127  }
128 
129  ///
130  const VectorBase<R>& lower() const
131  {
132  return low;
133  }
134 
135  /// Returns vector of lower bound values.
137  {
138  return low;
139  }
140 
141  ///
142  const R& lower(int i) const
143  {
144  return low[i];
145  }
146 
147  /// Returns lower bound of \p i 'th LPColBase in LPColSetBase.
148  R& lower_w(int i)
149  {
150  return low[i];
151  }
152 
153  ///
154  const R& lower(const DataKey& k) const
155  {
156  return low[number(k)];
157  }
158 
159  /// Returns lower bound of LPColBase with DataKey \p k in LPColSetBase.
160  R& lower_w(const DataKey& k)
161  {
162  return low[number(k)];
163  }
164 
165  ///
166  const VectorBase<R>& upper() const
167  {
168  return up;
169  }
170 
171  /// Returns vector of upper bound values.
173  {
174  return up;
175  }
176 
177  ///
178  const R& upper(int i) const
179  {
180  return up[i];
181  }
182 
183  /// Returns upper bound of \p i 'th LPColBase in LPColSetBase.
184  R& upper_w(int i)
185  {
186  return up[i];
187  }
188 
189  ///
190  const R& upper(const DataKey& k) const
191  {
192  return up[number(k)];
193  }
194 
195  /// Returns upper bound of LPColBase with DataKey \p k in LPColSetBase.
196  R& upper_w(const DataKey& k)
197  {
198  return up[number(k)];
199  }
200 
201  ///
203  {
204  return SVSetBase<R>::operator[](i);
205  }
206 
207  /// Returns colVector of \p i 'th LPColBase in LPColSetBase.
208  const SVectorBase<R>& colVector(int i) const
209  {
210  return SVSetBase<R>::operator[](i);
211  }
212 
213  /// Returns writeable colVector of LPColBase with DataKey \p k in LPColSetBase.
215  {
216  return SVSetBase<R>::operator[](k);
217  }
218 
219  /// Returns colVector of LPColBase with DataKey \p k in LPColSetBase.
220  const SVectorBase<R>& colVector(const DataKey& k) const
221  {
222  return SVSetBase<R>::operator[](k);
223  }
224 
225  /// Returns DataKey of \p i 'th LPColBase in LPColSetBase.
226  DataKey key(int i) const
227  {
228  return SVSetBase<R>::key(i);
229  }
230 
231  /// Returns number of LPColBase with DataKey \p k in LPColSetBase.
232  int number(const DataKey& k) const
233  {
234  return SVSetBase<R>::number(k);
235  }
236 
237  /// Does DataKey \p k belong to LPColSetBase ?
238  bool has(const DataKey& k) const
239  {
240  return SVSetBase<R>::has(k);
241  }
242 
243  //@}
244 
245  // ------------------------------------------------------------------------------------------------------------------
246  /**@name Extension
247  *
248  * All extension methods come with two signatures, one of which providing a parameter to return the assigned
249  * DataKey(s). See DataSet for a more detailed description. All extension methods are designed to automatically
250  * reallocate memory if required.
251  */
252  //@{
253 
254  ///
255  void add(const LPColBase<R>& pcol)
256  {
257  DataKey k;
258  add(k, pcol);
259  }
260 
261  /// Adds p pcol to LPColSetBase.
262  void add(DataKey& pkey, const LPColBase<R>& pcol)
263  {
264  add(pkey, pcol.obj(), pcol.lower(), pcol.colVector(), pcol.upper());
265  }
266 
267  ///
268  void add(const R& pobj, const R& plower, const SVectorBase<R>& pcolVector, const R& pupper, const int& pscaleExp = 0)
269  {
270  DataKey k;
271  add(k, pobj, plower, pcolVector, pupper, pscaleExp);
272  }
273 
274  /// Adds LPColBase consisting of objective value \p obj, lower bound \p lower, column vector \p colVector and upper bound \p upper to LPColSetBase.
275  void add(DataKey& newkey, const R& obj, const R& newlower, const SVectorBase<R>& newcolVector, const R& newupper, const int& newscaleExp = 0)
276  {
277  SVSetBase<R>::add(newkey, newcolVector);
278 
279  if( num() > low.dim() )
280  {
281  low.reDim(num());
282  up.reDim(num());
283  object.reDim(num());
284  scaleExp.reSize(num());
285  }
286 
287  low[num() - 1] = newlower;
288  up[num() - 1] = newupper;
289  object[num() - 1] = obj;
290  scaleExp[num() - 1] = newscaleExp;
291  }
292 
293  /// Adds LPColBase consisting of left hand side \p lhs, column vector \p colVector, and right hand side \p rhs to LPColSetBase.
294  template < class S >
295  void add(const S* obj, const S* lowerValue, const S* colValues, const int* colIndices, int colSize, const S* upperValue)
296  {
297  DataKey k;
298  add(k, obj, lowerValue, colValues, colIndices, colSize, upperValue);
299  }
300 
301  /// Adds LPColBase consisting of left hand side \p lhs, column vector \p colVector, and right hand side \p rhs to
302  /// LPColSetBase, with DataKey \p key.
303  template < class S >
304  void add(DataKey& newkey, const S* objValue, const S* lowerValue, const S* colValues, const int* colIndices, int colSize, const S* upperValue)
305  {
306  SVSetBase<R>::add(newkey, colValues, colIndices, colSize);
307 
308  if( num() > low.dim() )
309  {
310  low.reDim(num());
311  up.reDim(num());
312  object.reDim(num());
313  }
314 
315  low[num() - 1] = *lowerValue;
316  up[num() - 1] = *upperValue;
317  object[num() - 1] = *objValue;
318  }
319 
320  ///
321  void add(const LPColSetBase<R>& newset)
322  {
323  int i = num();
324 
325  SVSetBase<R>::add(newset);
326 
327  if( num() > low.dim() )
328  {
329  low.reDim(num());
330  up.reDim(num());
331  object.reDim(num());
332  scaleExp.reSize(num());
333  }
334 
335  for( int j = 0; i < num(); ++i, ++j )
336  {
337  low[i] = newset.lower(j);
338  up[i] = newset.upper(j);
339  object[i] = newset.maxObj(j);
340  scaleExp[i] = newset.scaleExp[j];
341  }
342  }
343 
344  /// Adds all LPColBase%s of \p set to LPColSetBase.
345  void add(DataKey keys[], const LPColSetBase<R>& newset)
346  {
347  int i = num();
348 
349  add(newset);
350 
351  for( int j = 0; i < num(); ++i, ++j )
352  keys[j] = key(i);
353  }
354 
355  /// Extends column \p n to fit \p newmax nonzeros.
356  void xtend(int n, int newmax)
357  {
358  SVSetBase<R>::xtend(colVector_w(n), newmax);
359  }
360 
361  /// Extends column with DataKey \p key to fit \p newmax nonzeros.
362  void xtend(const DataKey& pkey, int pnewmax)
363  {
364  SVSetBase<R>::xtend(colVector_w(pkey), pnewmax);
365  }
366 
367  ///
368  void add2(const DataKey& k, int n, const int idx[], const R val[])
369  {
370  SVSetBase<R>::add2(colVector_w(k), n, idx, val);
371  }
372 
373  /// Adds \p n nonzero (\p idx, \p val)-pairs to \p i 'th colVector.
374  void add2(int i, int n, const int idx[], const R val[])
375  {
376  SVSetBase<R>::add2(colVector_w(i), n, idx, val);
377  }
378 
379  /// Adds \p n nonzero (\p idx, \p val)-pairs to \p i 'th colVector.
380  template < class S >
381  void add2(int i, int n, const int idx[], const S val[])
382  {
383  SVSetBase<R>::add2(colVector_w(i), n, idx, val);
384  }
385 
386  ///
387  SVectorBase<R>& create(int pnonzeros = 0, const R& pobj = 1, const R& plw = 0, const R& pupp = 1, const int& pscaleExp = 0)
388  {
389  DataKey k;
390  return create(k, pnonzeros, pobj, plw, pupp, pscaleExp);
391  }
392 
393  /// Creates new LPColBase with specified arguments and returns a reference to its column vector.
394  SVectorBase<R>& create(DataKey& newkey, int nonzeros = 0, const R& obj = 1, const R& newlow = 0, const R& newup = 1, const int& newscaleExp = 0)
395  {
396  if( num() + 1 > low.dim() )
397  {
398  low.reDim(num() + 1);
399  up.reDim(num() + 1);
400  object.reDim(num() + 1);
401  scaleExp.reSize(num() + 1);
402  }
403 
404  low[num()] = newlow;
405  up[num()] = newup;
406  object[num()] = obj;
407  scaleExp[num()] = newscaleExp;
408 
409  return *SVSetBase<R>::create(newkey, nonzeros);
410  }
411 
412  //@}
413 
414 
415  // ------------------------------------------------------------------------------------------------------------------
416  /**@name Shrinking
417  *
418  * See DataSet for a description of the renumbering of the remaining LPColBase%s in a LPColSetBase after the call of
419  * a removal method.
420  */
421  //@{
422 
423  /// Removes \p i 'th LPColBase.
424  void remove(int i)
425  {
427  low[i] = low[num()];
428  up[i] = up[num()];
429  object[i] = object[num()];
430  scaleExp[i] = scaleExp[num()];
431  low.reDim(num());
432  up.reDim(num());
433  object.reDim(num());
434  scaleExp.reSize(num());
435  }
436 
437  /// Removes LPColBase with DataKey \p k.
438  void remove(const DataKey& k)
439  {
440  remove(number(k));
441  }
442 
443  /// Removes multiple elements.
444  void remove(int perm[])
445  {
446  int n = num();
447 
448  SVSetBase<R>::remove(perm);
449 
450  for( int i = 0; i < n; ++i )
451  {
452  if( perm[i] >= 0 && perm[i] != i )
453  {
454  low[perm[i]] = low[i];
455  up[perm[i]] = up[i];
456  object[perm[i]] = object[i];
457  scaleExp[perm[i]] = scaleExp[i];
458  }
459  }
460 
461  low.reDim(num());
462  up.reDim(num());
463  object.reDim(num());
464  scaleExp.reSize(num());
465  }
466 
467  /// Removes LPColBase%s with numbers \p nums, where \p n is the length of the array \p nums
468  void remove(const int nums[], int n)
469  {
470  DataArray < int > perm(num());
471  remove(nums, n, perm.get_ptr());
472  }
473 
474  /// Removes LPColBase%s with numbers \p nums, where \p n is the length of the array \p nums, and stores the index permutation in array \p perm.
475  void remove(const int nums[], int n, int* perm)
476  {
477  SVSetBase<R>::remove(nums, n, perm);
478 
479  int j = num();
480 
481  for( int i = 0; i < j; ++i )
482  {
483  if( perm[i] >= 0 && perm[i] != i )
484  {
485  low[perm[i]] = low[i];
486  up[perm[i]] = up[i];
487  object[perm[i]] = object[i];
488  scaleExp[perm[i]] = scaleExp[i];
489  }
490  }
491 
492  low.reDim(num());
493  up.reDim(num());
494  object.reDim(num());
495  scaleExp.reSize(num());
496  }
497 
498  /// Removes all LPColBase%s from the set.
499  void clear()
500  {
502  low.reDim(num());
503  up.reDim(num());
504  object.reDim(num());
505  scaleExp.clear();
506  }
507 
508  //@}
509 
510  // ------------------------------------------------------------------------------------------------------------------
511  /**@name Memory Management
512  * See SVSet for a description of the memory management methods.
513  */
514  //@{
515 
516  /// Reallocates memory to be able to store \p newmax LPColBase%s.
517  void reMax(int newmax = 0)
518  {
519  SVSetBase<R>::reMax(newmax);
520  up.reSize(max());
521  low.reSize(max());
522  object.reSize(max());
523  scaleExp.reSize(max());
524  }
525 
526  /// Returns used nonzero memory.
527  int memSize() const
528  {
529  return SVSetBase<R>::memSize();
530  }
531 
532  /// Returns length of nonzero memory.
533  int memMax() const
534  {
535  return SVSetBase<R>::memMax();
536  }
537 
538  /// Resets length of nonzero memory.
539  void memRemax(int newmax)
540  {
541  SVSetBase<R>::memRemax(newmax);
542  }
543 
544  /// Garbage collection in nonzero memory.
545  void memPack()
546  {
548  }
549 
550  //@}
551 
552  // ------------------------------------------------------------------------------------------------------------------
553  /**@name Miscellaneous */
554  //@{
555 
556  /// Checks consistency.
557  bool isConsistent() const
558  {
559 #ifdef ENABLE_CONSISTENCY_CHECKS
560  if( low.dim() != object.dim() )
561  return MSGinconsistent("LPColSetBase");
562  if( low.dim() != up.dim() )
563  return MSGinconsistent("LPColSetBase");
564  if( low.dim() != num() )
565  return MSGinconsistent("LPColSetBase");
566 
567  return low.isConsistent() && up.isConsistent() && SVSetBase<R>::isConsistent();
568 #else
569  return true;
570 #endif
571  }
572 
573  //@}
574 
575  // ------------------------------------------------------------------------------------------------------------------
576  /**@name Constructors / Destructors */
577  //@{
578 
579  /// Default constructor.
580  /** The user can specify the initial maximum number of columns \p max and the initial maximum number of nonzero
581  * entries \p memmax. If these parameters are omitted, a default size is used. However, one can add an arbitrary
582  * number of columns to the LPColSetBase, which may result in automated memory realllocation.
583  */
584  explicit
585  LPColSetBase<R>(int pmax = -1, int pmemmax = -1)
586  : SVSetBase<R>(pmax, pmemmax), low(0), up(0), object(0), scaleExp(0)
587  {
588  assert(isConsistent());
589  }
590 
591  /// Assignment operator.
593  {
594  if( this != &rs )
595  {
597  low = rs.low;
598  up = rs.up;
599  object = rs.object;
600  scaleExp = rs.scaleExp;
601 
602  assert(isConsistent());
603  }
604 
605  return *this;
606  }
607 
608  /// Assignment operator.
609  template < class S >
611  {
612  if( this != (const LPColSetBase<R>*)(&rs) )
613  {
615  low = rs.low;
616  up = rs.up;
617  object = rs.object;
618  scaleExp = rs.scaleExp;
619 
620  assert(isConsistent());
621  }
622 
623  return *this;
624  }
625 
626  /// Copy constructor.
628  : SVSetBase<R>(rs)
629  , low(rs.low)
630  , up(rs.up)
631  , object(rs.object)
632  , scaleExp(rs.scaleExp)
633  {
634  assert(isConsistent());
635  }
636 
637  /// Copy constructor.
638  template < class S >
640  : SVSetBase<R>(rs)
641  , low(rs.low)
642  , up(rs.up)
643  , object(rs.object)
644  , scaleExp(rs.scaleExp)
645  {
646  assert(isConsistent());
647  }
648 
649  /// Destructor.
650  virtual ~LPColSetBase<R>()
651  {}
652 
653  //@}
654 };
655 
656 } // namespace soplex
657 #endif // _LPCOLSETBASE_H_
SVectorBase< R > & create(int pnonzeros=0, const R &pobj=1, const R &plw=0, const R &pupp=1, const int &pscaleExp=0)
Definition: lpcolsetbase.h:387
void memRemax(int newmax)
Resets length of nonzero memory.
Definition: lpcolsetbase.h:539
void add(const S *obj, const S *lowerValue, const S *colValues, const int *colIndices, int colSize, const S *upperValue)
Adds LPColBase consisting of left hand side lhs, column vector colVector, and right hand side rhs to ...
Definition: lpcolsetbase.h:295
R & upper_w(const DataKey &k)
Returns upper bound of LPColBase with DataKey k in LPColSetBase.
Definition: lpcolsetbase.h:196
void reDim(int newdim, const bool setZero=true)
Resets DVectorBase&#39;s dimension to newdim.
Definition: dvectorbase.h:249
R & maxObj_w(const DataKey &k)
Returns objective value (w.r.t. maximization) of LPColBase with DataKey k in LPColSetBase.
Definition: lpcolsetbase.h:124
const VectorBase< R > & lower() const
Definition: lpcolsetbase.h:130
bool isConsistent() const
Consistency check.
Definition: dvectorbase.h:302
SVSetBase< R > & operator=(const SVSetBase< R > &rhs)
Assignment operator.
Definition: svsetbase.h:970
Entry identifier class for items of a DataSet.
void reMax(int newmax=0)
Resets maximum number of SVectorBases.
Definition: svsetbase.h:915
Dynamic dense vectors.Class DVectorBase is a derived class of VectorBase adding automatic memory mana...
Definition: dvectorbase.h:48
Dense vector.Class VectorBase provides dense linear algebra vectors. It does not provide memory manag...
Definition: dsvectorbase.h:28
SVectorBase< R > & colVector_w(const DataKey &k)
Returns writeable colVector of LPColBase with DataKey k in LPColSetBase.
Definition: lpcolsetbase.h:214
T * get_ptr()
get a C pointer to the data.
Definition: dataarray.h:110
DataKey key(int i) const
Returns DataKey of i &#39;th LPColBase in LPColSetBase.
Definition: lpcolsetbase.h:226
const R & lower(const DataKey &k) const
Definition: lpcolsetbase.h:154
void memPack()
Garbage collection in nonzero memory.
Definition: lpcolsetbase.h:545
int memSize() const
Returns used nonzero memory.
Definition: lpcolsetbase.h:527
int number(const DataKey &k) const
Gets vector number of DataKey.
Definition: svsetbase.h:770
void add(const LPColBase< R > &pcol)
Definition: lpcolsetbase.h:255
R obj() const
Gets objective value.
Definition: lpcolbase.h:113
void clear()
remove all elements.
Definition: dataarray.h:205
int memSize() const
Used nonzero memory.
Definition: svsetbase.h:806
SVectorBase< R > * create(int idxmax=0)
Creates new SVectorBase in set.
Definition: svsetbase.h:428
VectorBase< R > & maxObj_w()
Returns vector of objective values w.r.t. maximization.
Definition: lpcolsetbase.h:100
VectorBase< R > & lower_w()
Returns vector of lower bound values.
Definition: lpcolsetbase.h:136
const VectorBase< R > & maxObj() const
Definition: lpcolsetbase.h:94
VectorBase< R > & upper_w()
Returns vector of upper bound values.
Definition: lpcolsetbase.h:172
DataArray< int > scaleExp
column scaling factors (stored as bitshift)
Definition: lpcolsetbase.h:61
Entry identifier class for items of a DataSet.Every item in a DataSet is assigned a DataKey by which ...
Definition: datakey.h:46
DataKey key(int n) const
Gets DataKey of vector number.
Definition: svsetbase.h:758
DVectorBase< R > object
vector of objective coefficients.
Definition: lpcolsetbase.h:55
bool isConsistent() const
Checks consistency.
Definition: lpcolsetbase.h:557
R lower() const
Gets lower bound.
Definition: lpcolbase.h:137
int number(const DataKey &k) const
Returns number of LPColBase with DataKey k in LPColSetBase.
Definition: lpcolsetbase.h:232
const SVectorBase< R > & colVector() const
Gets constraint column vector.
Definition: lpcolbase.h:148
void add2(int i, int n, const int idx[], const S val[])
Adds n nonzero (idx, val)-pairs to i &#39;th colVector.
Definition: lpcolsetbase.h:381
void reSize(int newsize)
Resets DVectorBase&#39;s memory size to newsize.
Definition: dvectorbase.h:266
const R & maxObj(int i) const
Definition: lpcolsetbase.h:106
void add(const SVectorBase< R > &svec)
Adds svec to the set.
Definition: svsetbase.h:305
bool has(const DataKey &k) const
Does DataKey k belong to LPColSetBase ?
Definition: lpcolsetbase.h:238
SVectorBase< R > & colVector_w(int i)
Definition: lpcolsetbase.h:202
int memMax() const
Length of nonzero memory.
Definition: svsetbase.h:812
SVectorBase< R > & operator[](int n)
Gets SVectorBase by number, writeable.
Definition: svsetbase.h:716
R & maxObj_w(int i)
Returns objective value (w.r.t. maximization) of i &#39;th LPColBase in LPColSetBase. ...
Definition: lpcolsetbase.h:112
bool has(const DataKey &k) const
True iff SVSetBase contains a SVectorBase for DataKey k.
Definition: svsetbase.h:782
bool isConsistent() const
Consistency check.
Definition: svsetbase.h:921
const SVectorBase< R > & colVector(const DataKey &k) const
Returns colVector of LPColBase with DataKey k in LPColSetBase.
Definition: lpcolsetbase.h:220
void add(DataKey &pkey, const LPColBase< R > &pcol)
Adds p pcol to LPColSetBase.
Definition: lpcolsetbase.h:262
DVectorBase< R > up
vector of upper bounds.
Definition: lpcolsetbase.h:54
void add(DataKey &newkey, const S *objValue, const S *lowerValue, const S *colValues, const int *colIndices, int colSize, const S *upperValue)
Adds LPColBase consisting of left hand side lhs, column vector colVector, and right hand side rhs to ...
Definition: lpcolsetbase.h:304
LPColSetBase< R > & operator=(const LPColSetBase< R > &rs)
Assignment operator.
Definition: lpcolsetbase.h:592
int max() const
Returns maximum number of LPColBases currently fitting into LPColSetBase.
Definition: lpcolsetbase.h:88
void memRemax(int newmax)
Reset length of nonzero memory.
Definition: svsetbase.h:818
void memPack()
Garbage collection in nonzero memory.
Definition: svsetbase.h:867
const R & upper(int i) const
Definition: lpcolsetbase.h:178
Debugging, floating point type and parameter definitions.
void add(DataKey keys[], const LPColSetBase< R > &newset)
Adds all LPColBases of set to LPColSetBase.
Definition: lpcolsetbase.h:345
const R & maxObj(const DataKey &k) const
Definition: lpcolsetbase.h:118
Collection of dense, sparse, and semi-sparse vectors.
int dim() const
Dimension of vector.
Definition: vectorbase.h:215
Everything should be within this namespace.
void add(const LPColSetBase< R > &newset)
Definition: lpcolsetbase.h:321
const R & upper(const DataKey &k) const
Definition: lpcolsetbase.h:190
DVectorBase< R > low
vector of lower bounds.
Definition: lpcolsetbase.h:53
Set of LP columns.Class LPColSetBase implements a set of LPColBase%s. Unless for memory limitations...
Definition: lpcolsetbase.h:43
SVectorBase< R > & create(DataKey &newkey, int nonzeros=0, const R &obj=1, const R &newlow=0, const R &newup=1, const int &newscaleExp=0)
Creates new LPColBase with specified arguments and returns a reference to its column vector...
Definition: lpcolsetbase.h:394
R upper() const
Gets upper bound.
Definition: lpcolbase.h:125
const R & lower(int i) const
Definition: lpcolsetbase.h:142
int memMax() const
Returns length of nonzero memory.
Definition: lpcolsetbase.h:533
R & lower_w(const DataKey &k)
Returns lower bound of LPColBase with DataKey k in LPColSetBase.
Definition: lpcolsetbase.h:160
LPColSetBase< R > & operator=(const LPColSetBase< S > &rs)
Assignment operator.
Definition: lpcolsetbase.h:610
void xtend(const DataKey &pkey, int pnewmax)
Extends column with DataKey key to fit newmax nonzeros.
Definition: lpcolsetbase.h:362
void add2(SVectorBase< R > &svec, int idx, R val)
Adds nonzero (idx, val) to svec of this SVSetBase.
Definition: svsetbase.h:553
void xtend(int n, int newmax)
Extends column n to fit newmax nonzeros.
Definition: lpcolsetbase.h:356
const VectorBase< R > & upper() const
Definition: lpcolsetbase.h:166
LP column.
R & lower_w(int i)
Returns lower bound of i &#39;th LPColBase in LPColSetBase.
Definition: lpcolsetbase.h:148
void add(DataKey &newkey, const R &obj, const R &newlower, const SVectorBase< R > &newcolVector, const R &newupper, const int &newscaleExp=0)
Adds LPColBase consisting of objective value obj, lower bound lower, column vector colVector and uppe...
Definition: lpcolsetbase.h:275
void xtend(SVectorBase< R > &svec, int newmax)
Extends svec to fit newmax nonzeros.
Definition: svsetbase.h:475
void add(const R &pobj, const R &plower, const SVectorBase< R > &pcolVector, const R &pupper, const int &pscaleExp=0)
Definition: lpcolsetbase.h:268
R & upper_w(int i)
Returns upper bound of i &#39;th LPColBase in LPColSetBase.
Definition: lpcolsetbase.h:184
void remove(const DataKey &removekey)
Removes the vector with key removekey from the set.
Definition: svsetbase.h:593
Sparse vectors.Class SVectorBase provides packed sparse vectors. Such are a sparse vectors...
Definition: dvectorbase.h:31
void add2(int i, int n, const int idx[], const R val[])
Adds n nonzero (idx, val)-pairs to i &#39;th colVector.
Definition: lpcolsetbase.h:374
void add2(const DataKey &k, int n, const int idx[], const R val[])
Definition: lpcolsetbase.h:368
const SVSetBase< R > * colSet() const
Returns the complete SVSetBase.
Definition: lpcolsetbase.h:68
#define MSGinconsistent(name)
Definition: spxdefines.h:126
const SVectorBase< R > & colVector(int i) const
Returns colVector of i &#39;th LPColBase in LPColSetBase.
Definition: lpcolsetbase.h:208
void clear()
Removes all LPColBases from the set.
Definition: lpcolsetbase.h:499
int max() const
Current maximum number of SVectorBases.
Definition: svsetbase.h:752
void reMax(int newmax=0)
Reallocates memory to be able to store newmax LPColBases.
Definition: lpcolsetbase.h:517
void reSize(int newsize)
reset size to newsize.
Definition: dataarray.h:223
int num() const
Current number of SVectorBases.
Definition: svsetbase.h:746
int num() const
Returns the number of LPColBases currently in LPColSetBase.
Definition: lpcolsetbase.h:82
LP column.Class LPColBase provides a datatype for storing the column of an LP a the form similar to ...
Definition: lpcolbase.h:45
Sparse vector set.Class SVSetBase provides a set of sparse vectors SVectorBase. All SVectorBases in a...
Definition: ssvectorbase.h:33
void clear()
Removes all elements.
Definition: classarray.h:202