Scippy

SoPlex

Sequential object-oriented simPlex

spxweightst.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-2016 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 //#define TEST 1
17 
18 #include <assert.h>
19 #include <iostream>
20 
21 #include "spxdefines.h"
22 #include "spxweightst.h"
23 #include "svset.h"
24 #include "sorter.h"
25 
26 namespace soplex
27 {
28 #define EPS 1e-6
29 #define STABLE 1e-3 // the sparsest row/column may only have a pivot of size STABLE*maxEntry
30 
32 {
33 #ifdef ENABLE_CONSISTENCY_CHECKS
34  return rowWeight.isConsistent()
37  && colUp.isConsistent();
38  // && SPxStarter::isConsistent(); // not yet implemented
39 #else
40  return true;
41 #endif
42 }
43 
44 /* Generating the Starting Basis
45  The generation of a starting basis works as follows: After setting up the
46  preference arrays #weight# and #coWeight#, #Id#s are selected to be dual in
47  a greedy manner. Initially, the first #Id# is taken. Then the next #Id# is
48  checked wheter its vector is linearly dependend of the vectors of the #Id#s
49  allready selected. If not, it is added to them. This is iterated until a
50  full matrix has been constructed.
51 
52  Testing for linear independence is done very much along the lines of LU
53  factorization. A vector is taken, and updated with all previous L-vectors.
54  Then the maximal absolut element is selected as pivot element for computing
55  the L-vector. This is stored for further processing.
56  */
57 
58 /*
59  The following two functions set the status of |id| to primal or dual,
60  respectively.
61  */
63  SPxBasis::Desc& desc,
64  const SPxSolver& base,
65  const SPxId& id)
66 {
67  if (id.isSPxRowId())
68  {
69  int n = base.number(SPxRowId(id));
70 
71  if (base.rhs(n) >= infinity)
72  {
73  if (base.lhs(n) <= -infinity)
75  else
77  }
78  else
79  {
80  if (base.lhs(n) <= -infinity)
82  else if (base.lhs(n) >= base.rhs(n) - base.epsilon())
84  else if (rowRight[n])
86  else
88  }
89  }
90  else
91  {
92  int n = base.number(SPxColId(id));
93  if (base.SPxLP::upper(n) >= infinity)
94  {
95  if (base.SPxLP::lower(n) <= -infinity)
97  else
99  }
100  else
101  {
102  if (base.SPxLP::lower(n) <= -infinity)
104  else if (base.SPxLP::lower(n) >= base.SPxLP::upper(n) - base.epsilon())
106  else if (colUp[n])
108  else
110  }
111  }
112 }
113 
114 // ----------------------------------------------------------------
115 static void setDualStatus(
116  SPxBasis::Desc& desc,
117  const SPxSolver& base,
118  const SPxId& id)
119 {
120  if (id.isSPxRowId())
121  {
122  int n = base.number(SPxRowId(id));
123  desc.rowStatus(n) = base.basis().dualRowStatus(n);
124  }
125  else
126  {
127  int n = base.number(SPxColId(id));
128  desc.colStatus(n) = base.basis().dualColStatus(n);
129  }
130 }
131 // ----------------------------------------------------------------
132 
133 /// Compare class for row weights, used for sorting.
134 struct Compare
135 {
136 public:
137  /// constructor
138  Compare() : weight( 0 ) {}
139 // const SPxSolver* base; ///< the solver
140  const Real* weight; ///< the weights to compare
141 
142  /// compares the weights
143  Real operator()(int i1, int i2) const
144  {
145  return weight[i1] - weight[i2];
146  }
147 };
148 
149 // ----------------------------------------------------------------
150 /**
151  The following method initializes \p pref such that it contains the
152  set of \ref soplex::SPxId "SPxIds" ordered following \p rowWeight and
153  \p colWeight. For the sorting we take the following approach: first
154  we sort the rows, then the columns. Finally we perform a mergesort
155  of both.
156  */
157 static void initPrefs(
158  DataArray<SPxId>& pref,
159  const SPxSolver& base,
160  const DataArray<Real>& rowWeight,
161  const DataArray<Real>& colWeight)
162 {
163  DataArray<int> row(base.nRows());
164  DataArray<int> col(base.nCols());
165  int i;
166  int j;
167  int k;
168 
169  Compare compare;
170 // compare.base = &base;
171 
172  for(i = 0; i < base.nRows(); ++i)
173  row[i] = i;
174 
175  compare.weight = rowWeight.get_const_ptr();
176 
177  SPxQuicksort(row.get_ptr(), row.size(), compare); // Sort rows
178 
179  for(i = 0; i < base.nCols(); ++i)
180  col[i] = i;
181 
182  compare.weight = colWeight.get_const_ptr();
183 
184  SPxQuicksort(col.get_ptr(), col.size(), compare); // Sort column
185 
186  i = 0;
187  j = 0;
188  k = 0;
189 
190  while(k < pref.size()) // merge sort
191  {
192  if (rowWeight[row[i]] < colWeight[col[j]])
193  {
194  pref[k++] = base.rId(row[i++]);
195 
196  if (i >= base.nRows())
197  while (k < pref.size())
198  pref[k++] = base.cId(col[j++]);
199  }
200  else
201  {
202  pref[k++] = base.cId(col[j++]);
203 
204  if (j >= base.nCols())
205  while (k < pref.size())
206  pref[k++] = base.rId(row[i++]);
207  }
208  }
209  assert(i == base.nRows());
210  assert(j == base.nCols());
211 }
212 
213 // ----------------------------------------------------------------
215 {
216  SPxId tmpId;
217 
218  forbidden.reSize(base.dim());
219  rowWeight.reSize(base.nRows());
220  colWeight.reSize(base.nCols());
221  rowRight.reSize (base.nRows());
222  colUp.reSize (base.nCols());
223 
224  if (base.rep() == SPxSolver::COLUMN)
225  {
226  weight = &colWeight;
227  coWeight = &rowWeight;
228  }
229  else
230  {
231  weight = &rowWeight;
232  coWeight = &colWeight;
233  }
234  assert(weight->size() == base.coDim());
235  assert(coWeight->size() == base.dim());
236 
237  setupWeights(base);
238 
239  SPxBasis::Desc desc(base);
240  // desc.reSize(base.nRows(), base.nCols());
241 
242  DataArray < SPxId > pref(base.nRows() + base.nCols());
243  initPrefs(pref, base, rowWeight, colWeight);
244 
245  int i;
246  int stepi;
247  int j;
248  int sel;
249 
250  for(i = 0; i < base.dim(); ++i)
251  forbidden[i] = 0;
252 
253  if (base.rep() == SPxSolver::COLUMN)
254  {
255  // in COLUMN rep we scan from beginning to end
256  i = 0;
257  stepi = 1;
258  }
259  else
260  {
261  // in ROW rep we scan from end to beginning
262  i = pref.size() - 1;
263  stepi = -1;
264  }
265 
266  int dim = base.dim();
267  Real maxEntry = 0;
268 
269  for (; i >= 0 && i < pref.size(); i += stepi)
270  {
271  tmpId = pref[i];
272  const SVector& vec = base.vector(tmpId);
273  sel = -1;
274 
275  // column or row singleton ?
276  if (vec.size() == 1)
277  {
278  int idx = vec.index(0);
279 
280  if (forbidden[idx] < 2)
281  {
282  sel = idx;
283  dim += (forbidden[idx] > 0) ? 1 : 0;
284  }
285  }
286  else
287  {
288  maxEntry = vec.maxAbs();
289 
290  // initialize the nonzero counter
291  int minRowEntries = base.nRows();
292 
293  // find a stable index with a sparse row/column
294  for (j = vec.size(); --j >= 0;)
295  {
296  Real x = vec.value(j);
297  int k = vec.index(j);
298  int nRowEntries = base.coVector(k).size();
299 
300  if (!forbidden[k] && (spxAbs(x) > STABLE * maxEntry) && (nRowEntries < minRowEntries))
301  {
302  minRowEntries = nRowEntries;
303  sel = k;
304  }
305  }
306  }
307 
308  // we found a valid index
309  if (sel >= 0)
310  {
311  MSG_DEBUG(
312  if (pref[i].type() == SPxId::ROW_ID)
313  std::cout << "DWEIST01 r" << base.number(pref[i]);
314  else
315  std::cout << "DWEIST02 c" << base.number(pref[i]);
316  )
317 
318  forbidden[sel] = 2;
319 
320  // put current column/row into basis
321  if (base.rep() == SPxSolver::COLUMN)
322  setDualStatus(desc, base, pref[i]);
323  else
324  setPrimalStatus(desc, base, pref[i]);
325 
326  for (j = vec.size(); --j >= 0;)
327  {
328  Real x = vec.value(j);
329  int k = vec.index(j);
330 
331  if (!forbidden[k] && (x > EPS * maxEntry || -x > EPS * maxEntry))
332  {
333  forbidden[k] = 1;
334  --dim;
335  }
336  }
337 
338  if (--dim == 0)
339  {
340  //@ for(++i; i < pref.size(); ++i)
341  if (base.rep() == SPxSolver::COLUMN)
342  {
343  // set all remaining indeces to nonbasic status
344  for (i += stepi; i >= 0 && i < pref.size(); i += stepi)
345  setPrimalStatus(desc, base, pref[i]);
346 
347  // fill up the basis wherever linear independence is assured
348  for (i = forbidden.size(); --i >= 0;)
349  {
350  if (forbidden[i] < 2)
351  setDualStatus(desc, base, base.coId(i));
352  }
353  }
354  else
355  {
356  for (i += stepi; i >= 0 && i < pref.size(); i += stepi)
357  setDualStatus(desc, base, pref[i]);
358 
359  for (i = forbidden.size(); --i >= 0;)
360  {
361  if (forbidden[i] < 2)
362  setPrimalStatus(desc, base, base.coId(i));
363  }
364  }
365  break;
366  }
367  }
368  // sel == -1
369  else if (base.rep() == SPxSolver::COLUMN)
370  setPrimalStatus(desc, base, pref[i]);
371  else
372  setDualStatus(desc, base, pref[i]);
373 #ifndef NDEBUG
374  {
375  int n, m;
376  for (n = 0, m = forbidden.size(); n < forbidden.size(); ++n)
377  m -= (forbidden[n] != 0) ? 1 : 0;
378  assert(m == dim);
379  }
380 #endif // NDEBUG
381  }
382  assert(dim == 0);
383 
384  base.loadBasis(desc);
385 #ifdef TEST
386  base.init();
387 
388  int changed = 0;
389  const Vector& pvec = base.pVec();
390  for (i = pvec.dim() - 1; i >= 0; --i)
391  {
393  && base.lower(i) > -infinity && pvec[i] > base.maxObj(i))
394  {
395  changed = 1;
397  }
398  else if (desc.colStatus(i) == SPxBasis::Desc::P_ON_LOWER
399  && base.upper(i) < infinity && pvec[i] < base.maxObj(i))
400  {
401  changed = 1;
403  }
404  }
405 
406  if (changed)
407  {
408  std::cout << "changed basis\n";
409  base.loadBasis(desc);
410  }
411  else
412  std::cout << "nothing changed\n";
413 #endif // TEST
414 }
415 
416 // ----------------------------------------------------------------
417 
418 /* Computation of Weights
419  */
421 {
422  const Vector& obj = base.maxObj();
423  const Vector& low = base.lower();
424  const Vector& up = base.upper();
425  const Vector& rhs = base.rhs();
426  const Vector& lhs = base.lhs();
427  int i;
428 
429  Real eps = base.epsilon();
430  Real maxabs = 1.0;
431 
432  // find absolut biggest entry in bounds and left-/right hand side
433  for (i = 0; i < base.nCols(); i++)
434  {
435  if ((up[i] < infinity) && (spxAbs(up[i]) > maxabs))
436  maxabs = spxAbs(up[i]);
437 
438  if ((low[i] > -infinity) && (spxAbs(low[i]) > maxabs))
439  maxabs = spxAbs(low[i]);
440  }
441  for (i = 0; i < base.nRows(); i++)
442  {
443  if ((rhs[i] < infinity) && (spxAbs(rhs[i]) > maxabs))
444  maxabs = spxAbs(rhs[i]);
445 
446  if ((lhs[i] > -infinity) && (spxAbs(lhs[i]) > maxabs))
447  maxabs = spxAbs(lhs[i]);
448  }
449 
450  /**@todo The comments are wrong. The first is for dual simplex and
451  * the secound for primal one. Is anything else wrong?
452  * Also the values are nearly the same for both cases.
453  * Should this be ? Changed the values for
454  * r_fixed to 0 because of maros-r7. It is not clear why
455  * this makes a difference because all constraints in that
456  * instance are of equality type.
457  * Why is rowRight sometimes not set?
458  */
459  if (base.rep() * base.type() > 0) // primal simplex
460  {
461  const Real ax = 1e-3 / obj.maxAbs();
462  const Real bx = 1.0 / maxabs;
463  const Real nne = ax / base.nRows(); // 1e-4 * ax;
464  const Real c_fixed = 1e+5;
465  const Real r_fixed = 0; // TK20010103: was 1e+4 (maros-r7)
466  const Real c_dbl_bounded = 1e+1;
467  const Real r_dbl_bounded = 0;
468  const Real c_bounded = 1e+1;
469  const Real r_bounded = 0;
470  const Real c_free = -1e+4;
471  const Real r_free = -1e+5;
472 
473  for (i = base.nCols() - 1; i >= 0; i--)
474  {
475  Real n = nne * (base.colVector(i).size() - 1); // very small value that is zero for col singletons
476  Real x = ax * obj[i]; // this is at most 1e-3, probably a lot smaller
477  Real u = bx * up [i]; // this is at most 1, probably a lot smaller
478  Real l = bx * low[i]; // this is at most 1, probably a lot smaller
479 
480  if (up[i] < infinity)
481  {
482  if (spxAbs(low[i] - up[i]) < eps)
483  colWeight[i] = c_fixed + n + spxAbs(x);
484  else if (low[i] > -infinity)
485  {
486  colWeight[i] = c_dbl_bounded + l - u + n;
487 
488  l = spxAbs(l);
489  u = spxAbs(u);
490 
491  if (u < l)
492  {
493  colUp[i] = true;
494  colWeight[i] += x;
495  }
496  else
497  {
498  colUp[i] = false;
499  colWeight[i] -= x;
500  }
501  }
502  else
503  {
504  colWeight[i] = c_bounded - u + x + n;
505  colUp[i] = true;
506  }
507  }
508  else
509  {
510  if (low[i] > -infinity)
511  {
512  colWeight[i] = c_bounded + l + n - x;
513  colUp[i] = false;
514  }
515  else
516  {
517  colWeight[i] = c_free + n - spxAbs(x);
518  }
519  }
520  }
521 
522  for (i = base.nRows() - 1; i >= 0; i--)
523  {
524  if (rhs[i] < infinity)
525  {
526  if (spxAbs(lhs[i] - rhs[i]) < eps)
527  {
528  rowWeight[i] = r_fixed;
529  }
530  else if (lhs[i] > -infinity)
531  {
532  Real u = bx * rhs[i];
533  Real l = bx * lhs[i];
534 
535  rowWeight[i] = r_dbl_bounded + l - u;
536  rowRight[i] = spxAbs(u) < spxAbs(l);
537  }
538  else
539  {
540  rowWeight[i] = r_bounded - bx * rhs[i];
541  rowRight[i] = true;
542  }
543  }
544  else
545  {
546  if (lhs[i] > -infinity)
547  {
548  rowWeight[i] = r_bounded + bx * lhs[i];
549  rowRight[i] = false;
550  }
551  else
552  {
553  rowWeight[i] = r_free;
554  }
555  }
556  }
557  }
558  else
559  {
560  assert(base.rep() * base.type() < 0); // dual simplex
561 
562  const Real ax = 1.0 / obj.maxAbs();
563  const Real bx = 1e-2 / maxabs;
564  const Real nne = 1e-4 * bx;
565  const Real c_fixed = 1e+5;
566  const Real r_fixed = 1e+4;
567  const Real c_dbl_bounded = 1;
568  const Real r_dbl_bounded = 0;
569  const Real c_bounded = 0;
570  const Real r_bounded = 0;
571  const Real c_free = -1e+4;
572  const Real r_free = -1e+5;
573 
574  for (i = base.nCols() - 1; i >= 0; i--)
575  {
576  Real n = nne * (base.colVector(i).size() - 1);
577  Real x = ax * obj[i];
578  Real u = bx * up [i];
579  Real l = bx * low[i];
580 
581  if (up[i] < infinity)
582  {
583  if (spxAbs(low[i] - up[i]) < eps)
584  colWeight[i] = c_fixed + n + spxAbs(x);
585  else if (low[i] > -infinity)
586  {
587  if (x > 0)
588  {
589  colWeight[i] = c_dbl_bounded + x - u + n;
590  colUp[i] = true;
591  }
592  else
593  {
594  colWeight[i] = c_dbl_bounded - x + l + n;
595  colUp[i] = false;
596  }
597  }
598  else
599  {
600  colWeight[i] = c_bounded - u + x + n;
601  colUp[i] = true;
602  }
603  }
604  else
605  {
606  if (low[i] > -infinity)
607  {
608  colWeight[i] = c_bounded - x + l + n;
609  colUp[i] = false;
610  }
611  else
612  colWeight[i] = c_free + n - spxAbs(x);
613  }
614  }
615 
616  for (i = base.nRows() - 1; i >= 0; i--)
617  {
618  const Real len1 = 1; // (base.rowVector(i).length() + base.epsilon());
619  Real n = 0; // nne * (base.rowVector(i).size() - 1);
620  Real u = bx * len1 * rhs[i];
621  Real l = bx * len1 * lhs[i];
622  Real x = ax * len1 * (obj * base.rowVector(i));
623 
624  if (rhs[i] < infinity)
625  {
626  if (spxAbs(lhs[i] - rhs[i]) < eps)
627  rowWeight[i] = r_fixed + n + spxAbs(x);
628  else if (lhs[i] > -infinity)
629  {
630  if (x > 0)
631  {
632  rowWeight[i] = r_dbl_bounded + x - u + n;
633  rowRight[i] = true;
634  }
635  else
636  {
637  rowWeight[i] = r_dbl_bounded - x + l + n;
638  rowRight[i] = false;
639  }
640  }
641  else
642  {
643  rowWeight[i] = r_bounded - u + n + x;
644  rowRight[i] = true;
645  }
646  }
647  else
648  {
649  if (lhs[i] > -infinity)
650  {
651  rowWeight[i] = r_bounded + l + n - x;
652  rowRight[i] = false;
653  }
654  else
655  {
656  rowWeight[i] = r_free + n - spxAbs(x);
657  }
658  }
659  }
660  }
661 
662  MSG_DEBUG({
663  for(i = 0; i < base.nCols(); i++)
664  std::cout << "C i= " << i
665  << " up= " << colUp[i]
666  << " w= " << colWeight[i]
667  << std::endl;
668  for(i = 0; i < base.nRows(); i++)
669  std::cout << "R i= " << i
670  << " rr= " << rowRight[i]
671  << " w= " << rowWeight[i]
672  << std::endl;
673  })
674 }
675 } // namespace soplex
Rational spxAbs(const Rational &r)
Absolute.
Definition: rational.cpp:3925
int dim() const
dimension of basis matrix.
Definition: spxsolver.h:936
int coDim() const
codimension.
Definition: spxsolver.h:941
DataArray< Real > * weight
Definition: spxweightst.h:66
Real operator()(int i1, int i2) const
compares the weights
Desc::Status dualRowStatus(int i) const
dual Status for the i&#39;th row variable of the loaded LP.
Definition: spxbasis.cpp:46
Safe arrays of data objects.Class DataArray provides safe arrays of Data Objects. For general C++ obj...
Definition: dataarray.h:63
Representation rep() const
return the current basis representation.
Definition: spxsolver.h:406
primal variable is fixed to both bounds
Definition: spxbasis.h:190
const VectorBase< R > & maxObj() const
Returns objective vector for maximization problem.
Definition: spxlpbase.h:384
static void initPrefs(DataArray< SPxId > &pref, const SPxSolver &base, const DataArray< Real > &rowWeight, const DataArray< Real > &colWeight)
Status & rowStatus(int i)
Definition: spxbasis.h:239
int number(const SPxRowId &id) const
Returns the row number of the row with identifier id.
Definition: spxlpbase.h:450
const SVectorBase< R > & colVector(int i) const
Returns column vector of column i.
Definition: spxlpbase.h:341
int size() const
Number of used indices.
Definition: svectorbase.h:152
const VectorBase< R > & lower() const
Returns lower bound vector.
Definition: spxlpbase.h:420
UpdateVector & pVec() const
pricing vector.
Definition: spxsolver.h:1339
R & value(int n)
Reference to value of n &#39;th nonzero.
Definition: svectorbase.h:254
Ids for LP columns.Class SPxColId provides DataKeys for the column indices of an SPxLP.
Definition: spxid.h:36
Compare class for row weights, used for sorting.
SPxId coId(int i) const
id of i &#39;th covector.
Definition: spxsolver.h:978
const VectorBase< R > & upper() const
Returns upper bound vector.
Definition: spxlpbase.h:402
DataArray< Real > rowWeight
weight value for LP rows.
Definition: spxweightst.h:84
bool isConsistent() const
consistency check
Definition: dataarray.h:288
virtual void setupWeights(SPxSolver &base)
sets up variable weights.
primal variable is set to its upper bound
Definition: spxbasis.h:188
Generic Ids for LP rows or columns.Both SPxColIds and SPxRowIds may be treated uniformly as SPxIds: ...
Definition: spxid.h:85
double Real
SOPLEX_DEBUG.
Definition: spxdefines.h:200
#define MSG_DEBUG(x)
Definition: spxdefines.h:127
int & index(int n)
Reference to index of n &#39;th nonzero.
Definition: svectorbase.h:236
Desc::Status dualColStatus(int i) const
dual Status for the i&#39;th column variable of the loaded LP.
Definition: spxbasis.cpp:69
#define EPS
Definition: spxweightst.cpp:28
const T * get_const_ptr() const
get a const C pointer to the data.
Definition: dataarray.h:115
SPxRowId rId(int n) const
Returns the row identifier for row n.
Definition: spxlpbase.h:470
int nCols() const
Returns number of columns in LP.
Definition: spxlpbase.h:133
void generate(SPxSolver &base)
generates start basis for loaded basis.
const SPxBasis & basis() const
Return current basis.
Definition: spxsolver.h:1616
virtual bool isConsistent() const
consistency check.
Definition: spxweightst.cpp:31
int size() const
return nr. of elements.
Definition: dataarray.h:211
primal variable is left free, but unset
Definition: spxbasis.h:189
Basis descriptor.
Definition: spxbasis.h:104
void SPxQuicksort(T *keys, int end, COMPARATOR &compare, int start=0, bool type=true)
Generic QuickSort implementation.
Definition: sorter.h:73
int dim() const
Dimension of vector.
Definition: vectorbase.h:174
row identifier.
Definition: spxid.h:97
Type type() const
return current Type.
Definition: spxsolver.h:412
Status & colStatus(int i)
Definition: spxbasis.h:254
Generic QuickSort implementation.
R maxAbs() const
Maximum absolute value, i.e., infinity norm.
Definition: vectorbase.h:314
Debugging, floating point type and parameter definitions.
virtual void loadBasis(const SPxBasis::Desc &)
set a start basis.
Definition: spxsolver.cpp:92
int nRows() const
Returns number of rows in LP.
Definition: spxlpbase.h:127
Sequential object-oriented SimPlex.SPxSolver is an LP solver class using the revised Simplex algorith...
Definition: spxsolver.h:84
const SVector & coVector(int i) const
i &#39;th covector of LP.
Definition: spxsolver.h:1062
const VectorBase< R > & lhs() const
Returns left hand side vector.
Definition: spxlpbase.h:242
Everything should be within this namespace.
Weighted start basis.
SPxColId cId(int n) const
Returns the column identifier for column n.
Definition: spxlpbase.h:476
primal variable is set to its lower bound
Definition: spxbasis.h:187
const SVector & vector(int i) const
i &#39;th vector.
Definition: spxsolver.h:1018
R maxAbs() const
Maximum absolute value, i.e., infinity norm.
Definition: svectorbase.h:439
Real epsilon() const
values are considered to be 0.
Definition: spxsolver.h:670
const Real * weight
the weights to compare
const Real infinity
Definition: spxdefines.cpp:26
const VectorBase< R > & rhs() const
Returns right hand side vector.
Definition: spxlpbase.h:224
Set of sparse vectors.
const SVectorBase< R > & rowVector(int i) const
Gets row vector of row i.
Definition: spxlpbase.h:212
virtual void init()
intialize data structures.
Definition: spxsolver.cpp:317
DataArray< Real > * coWeight
Definition: spxweightst.h:68
Ids for LP rows.Class SPxRowId provides DataKeys for the row indices of an SPxLP. ...
Definition: spxid.h:55
static void setDualStatus(SPxBasis::Desc &desc, const SPxSolver &base, const SPxId &id)
DataArray< Real > colWeight
weight value for LP columns.
Definition: spxweightst.h:86
DataArray< int > forbidden
Definition: spxweightst.h:64
Compare()
constructor
void setPrimalStatus(SPxBasis::Desc &, const SPxSolver &, const SPxId &)
Definition: spxweightst.cpp:62
void reSize(int newsize)
reset size to newsize.
Definition: dataarray.h:223
#define STABLE
Definition: spxweightst.cpp:29
DataArray< bool > colUp
set primal variable to upper bound.
Definition: spxweightst.h:90
columnwise representation.
Definition: spxsolver.h:108
DataArray< bool > rowRight
set variable to rhs?.
Definition: spxweightst.h:88