Scippy

SoPlex

Sequential object-oriented simPlex

spxdevexpr.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-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 #include "spxdefines.h"
17 #include "spxdevexpr.h"
18 
19 #define DEVEX_REFINETOL 2.0
20 
21 namespace soplex
22 {
23 
25 {
26  thesolver = base;
27  setRep(base->rep());
28  assert(isConsistent());
29 }
30 
32 {
33 #ifdef ENABLE_CONSISTENCY_CHECKS
34  if (thesolver != 0)
35  if (weights.dim() != thesolver->coDim()
36  || coWeights.dim() != thesolver->dim())
37  return MSGinconsistent("SPxDevexPR");
38 #endif
39 
40  return true;
41 }
42 
44 {
45  int i;
46  int coWeightSize = 0;
47  int weightSize = 0;
48 
49  DVector& weights = thesolver->weights;
50  DVector& coWeights = thesolver->coWeights;
51 
52  if( tp == SPxSolver::ENTER )
53  {
54  coWeights.reDim(thesolver->dim(), false);
55  for( i = thesolver->dim() - 1; i >= coWeightSize; --i )
56  coWeights[i] = 2.0;
57 
58  weights.reDim(thesolver->coDim(), false);
59  for( i = thesolver->coDim() - 1; i >= weightSize; --i )
60  weights[i] = 2.0;
61  }
62  else
63  {
64  coWeights.reDim(thesolver->dim(), false);
65  for( i = thesolver->dim() - 1; i >= coWeightSize; --i )
66  coWeights[i] = 1.0;
67  }
68  thesolver->weightsAreSetup = true;
69 }
70 
72 {
73  setupWeights(tp);
74  refined = false;
75 
76  bestPrices.clear();
79 
80  if( tp == SPxSolver::ENTER )
81  {
85  }
86 
87  assert(isConsistent());
88 }
89 
90 /**@todo suspicious: Shouldn't the relation between dim, coDim, Vecs,
91  * and CoVecs be influenced by the representation ?
92  */
94 {
95  if (thesolver != 0)
96  {
97  // resize weights and initialize new entries
100  assert(isConsistent());
101  }
102 }
103 
104 Real inline computePrice(Real viol, Real weight, Real tol)
105 {
106  if( weight < tol )
107  return viol * viol / tol;
108  else
109  return viol * viol / weight;
110 }
111 
112 
114 {
115  int idx;
116  int nsorted;
117  Real fTesti;
118  const Real* fTest = thesolver->fTest().get_const_ptr();
119  const Real* cpen = thesolver->coWeights.get_const_ptr();
120  IdxElement price;
121  prices.clear();
122  bestPrices.clear();
123 
124  // TODO we should check infeasiblities for duplicates or loop over dimension
125  // bestPrices may then also contain duplicates!
126  // construct vector of all prices
127  for (int i = thesolver->infeasibilities.size() - 1; i >= 0; --i)
128  {
129  idx = thesolver->infeasibilities.index(i);
130  fTesti = fTest[idx];
131  if (fTesti < -feastol)
132  {
134  price.idx = idx;
135  price.val = computePrice(fTesti, cpen[idx], feastol);
136  prices.append(price);
137  }
138  }
139  // set up structures for the quicksort implementation
141  // do a partial sort to move the best ones to the front
142  // TODO this can be done more efficiently, since we only need the indices
144  // copy indices of best values to bestPrices
145  for( int i = 0; i < nsorted; ++i )
146  {
147  bestPrices.addIdx(prices[i].idx);
149  }
150 
151  if( nsorted > 0 )
152  return prices[0].idx;
153  else
154  return -1;
155 }
156 
158 {
159  int retid;
160 
162  {
163  if ( bestPrices.size() < 2 || thesolver->basis().lastUpdate() == 0 )
164  {
165  // call init method to build up price-vector and return index of largest price
167  }
168  else
169  retid = selectLeaveHyper(theeps);
170  }
171  else if (thesolver->sparsePricingLeave)
172  retid = selectLeaveSparse(theeps);
173  else
174  retid = selectLeaveX(theeps);
175 
176  if ( retid < 0 && !refined )
177  {
178  refined = true;
179  MSG_INFO3( (*thesolver->spxout), (*thesolver->spxout) << "WDEVEX02 trying refinement step..\n"; )
181  }
182 
183  assert(retid < thesolver->dim());
184 
185  return retid;
186 }
187 
188 int SPxDevexPR::selectLeaveX(Real feastol, int start, int incr)
189 {
190  Real x;
191 
192  const Real* fTest = thesolver->fTest().get_const_ptr();
193  const Real* cpen = thesolver->coWeights.get_const_ptr();
194  Real best = 0;
195  int bstI = -1;
196  int end = thesolver->coWeights.dim();
197 
198  for (; start < end; start += incr)
199  {
200  if (fTest[start] < -feastol)
201  {
202  x = computePrice(fTest[start], cpen[start], feastol);
203  if (x > best)
204  {
205  best = x;
206  bstI = start;
207  last = cpen[start];
208  }
209  }
210  }
211  return bstI;
212 }
213 
215 {
216  Real x;
217 
218  const Real* fTest = thesolver->fTest().get_const_ptr();
219  const Real* cpen = thesolver->coWeights.get_const_ptr();
220  Real best = 0;
221  int bstI = -1;
222  int idx = -1;
223 
224  for (int i = thesolver->infeasibilities.size() - 1; i >= 0; --i)
225  {
226  idx = thesolver->infeasibilities.index(i);
227  x = fTest[idx];
228  if (x < -feastol)
229  {
230  x = computePrice(x, cpen[idx], feastol);
231  if (x > best)
232  {
233  best = x;
234  bstI = idx;
235  last = cpen[idx];
236  }
237  }
238  else
239  {
243  }
244  }
245  return bstI;
246 }
247 
249 {
250  Real x;
251 
252  const Real* fTest = thesolver->fTest().get_const_ptr();
253  const Real* cpen = thesolver->coWeights.get_const_ptr();
254  Real best = 0;
255  Real leastBest = infinity;
256  int bstI = -1;
257  int idx = -1;
258 
259  // find the best price from the short candidate list
260  for( int i = bestPrices.size() - 1; i >= 0; --i )
261  {
262  idx = bestPrices.index(i);
263  x = fTest[idx];
264  if( x < -feastol )
265  {
266  x = computePrice(x, cpen[idx], feastol);
267  if( x > best )
268  {
269  best = x;
270  bstI = idx;
271  last = cpen[idx];
272  }
273  // get the smallest price of candidate list
274  if( x < leastBest )
275  leastBest = x;
276  }
277  else
278  {
279  bestPrices.remove(i);
281  }
282  }
283 
284  // make sure we do not skip potential candidates due to a high leastBest value
285  if( leastBest == infinity )
286  {
287  assert(bestPrices.size() == 0);
288  leastBest = 0;
289  }
290 
291  // scan the updated indices for a better price
292  for( int i = thesolver->updateViols.size() - 1; i >= 0; --i )
293  {
294  idx = thesolver->updateViols.index(i);
295  // only look at indeces that were not checked already
296  if( thesolver->isInfeasible[idx] == VIOLATED )
297  {
298  x = fTest[idx];
299  assert(x < -feastol);
300  x = computePrice(x, cpen[idx], feastol);
301  if( x > leastBest )
302  {
303  if( x > best )
304  {
305  best = x;
306  bstI = idx;
307  last = cpen[idx];
308  }
309  // put index into candidate list
311  bestPrices.addIdx(idx);
312  }
313  }
314  }
315 
316  return bstI;
317 }
318 
319 void SPxDevexPR::left4(int n, SPxId id)
320 {
321  DVector& coWeights = thesolver->coWeights;
322  if (id.isValid())
323  {
324  int i, j;
325  Real x;
326  const Real* rhoVec = thesolver->fVec().delta().values();
327  Real rhov_1 = 1 / rhoVec[n];
328  Real beta_q = thesolver->coPvec().delta().length2() * rhov_1 * rhov_1;
329 
330 #ifndef NDEBUG
331  if (spxAbs(rhoVec[n]) < theeps)
332  {
333  MSG_INFO3( (*thesolver->spxout), (*thesolver->spxout) << "WDEVEX01: rhoVec = "
334  << rhoVec[n] << " with smaller absolute value than theeps = " << theeps << std::endl; )
335  }
336 #endif // NDEBUG
337 
338  // Update #coPenalty# vector
339  const IdxSet& rhoIdx = thesolver->fVec().idx();
340  int len = thesolver->fVec().idx().size();
341  for (i = len - 1; i >= 0; --i)
342  {
343  j = rhoIdx.index(i);
344  x = rhoVec[j] * rhoVec[j] * beta_q;
345  // if(x > coPenalty[j])
346  coWeights[j] += x;
347  }
348 
349  coWeights[n] = beta_q;
350  }
351 }
352 
354 {
355  int idx;
356  int nsorted;
357  Real x;
358  const Real* coTest = thesolver->coTest().get_const_ptr();
359  const Real* cpen = thesolver->coWeights.get_const_ptr();
360  IdxElement price;
361  prices.clear();
362  bestPrices.clear();
363 
364  // construct vector of all prices
365  for (int i = thesolver->infeasibilities.size() - 1; i >= 0; --i)
366  {
367  idx = thesolver->infeasibilities.index(i);
368  x = coTest[idx];
369  if ( x < -feastol)
370  {
372  price.idx = idx;
373  price.val = computePrice(x, cpen[idx], feastol);
374  prices.append(price);
375  }
376  else
377  {
380  }
381  }
382  // set up structures for the quicksort implementation
384  // do a partial sort to move the best ones to the front
385  // TODO this can be done more efficiently, since we only need the indices
387  // copy indices of best values to bestPrices
388  for( int i = 0; i < nsorted; ++i )
389  {
390  bestPrices.addIdx(prices[i].idx);
392  }
393 
394  if( nsorted > 0 )
395  {
396  best = prices[0].val;
397  return thesolver->coId(prices[0].idx);
398  }
399  else
400  return SPxId();
401 }
402 
404 {
405  int idx;
406  int nsorted;
407  Real x;
408  const Real* test = thesolver->test().get_const_ptr();
409  const Real* pen = thesolver->weights.get_const_ptr();
410  IdxElement price;
411  pricesCo.clear();
413 
414  // construct vector of all prices
415  for (int i = thesolver->infeasibilitiesCo.size() - 1; i >= 0; --i)
416  {
418  x = test[idx];
419  if ( x < -feastol)
420  {
422  price.idx = idx;
423  price.val = computePrice(x, pen[idx], feastol);
424  pricesCo.append(price);
425  }
426  else
427  {
430  }
431  }
432  // set up structures for the quicksort implementation
434  // do a partial sort to move the best ones to the front
435  // TODO this can be done more efficiently, since we only need the indices
437  // copy indices of best values to bestPrices
438  for( int i = 0; i < nsorted; ++i )
439  {
440  bestPricesCo.addIdx(pricesCo[i].idx);
442  }
443 
444  if( nsorted > 0 )
445  {
446  best = pricesCo[0].val;
447  return thesolver->id(pricesCo[0].idx);
448  }
449  else
450  return SPxId();
451 }
452 
454 {
455  assert(thesolver != 0);
456 
457  SPxId enterId;
458 
459  enterId = selectEnterX(theeps);
460 
461  if( !enterId.isValid() && !refined )
462  {
463  refined = true;
464  MSG_INFO3( (*thesolver->spxout), (*thesolver->spxout) << "WDEVEX02 trying refinement step..\n"; )
466  }
467 
468  return enterId;
469 }
470 
471 // choose the best entering index among columns and rows but prefer sparsity
473 {
474  SPxId enterId;
475  SPxId enterCoId;
476  Real best;
477  Real bestCo;
478 
479  best = 0;
480  bestCo = 0;
481  last = 1.0;
482 
483  // avoid uninitialized value later on in entered4X()
484  last = 1.0;
485 
487  {
488  if( bestPrices.size() < 2 || thesolver->basis().lastUpdate() == 0 )
489  enterCoId = (thesolver->sparsePricingEnter) ? buildBestPriceVectorEnterDim(best, tol) : selectEnterDenseDim(best, tol);
490  else
491  enterCoId = (thesolver->sparsePricingEnter) ? selectEnterHyperDim(best, tol) : selectEnterDenseDim(best, tol);
492 
493  if( bestPricesCo.size() < 2 || thesolver->basis().lastUpdate() == 0 )
494  enterId = (thesolver->sparsePricingEnterCo) ? buildBestPriceVectorEnterCoDim(bestCo, tol) : selectEnterDenseCoDim(bestCo, tol);
495  else
496  enterId = (thesolver->sparsePricingEnterCo) ? selectEnterHyperCoDim(bestCo, tol) : selectEnterDenseCoDim(bestCo, tol);
497  }
498  else
499  {
500  enterCoId = (thesolver->sparsePricingEnter && !refined) ? selectEnterSparseDim(best, tol) : selectEnterDenseDim(best, tol);
501  enterId = (thesolver->sparsePricingEnterCo && !refined) ? selectEnterSparseCoDim(bestCo, tol) : selectEnterDenseCoDim(bestCo, tol);
502  }
503 
504  // prefer coIds to increase the number of unit vectors in the basis matrix, i.e., rows in colrep and cols in rowrep
505  if( enterCoId.isValid() && (best > SPARSITY_TRADEOFF * bestCo || !enterId.isValid()) )
506  return enterCoId;
507  else
508  return enterId;
509 }
510 
512 {
513  const Real* cTest = thesolver->coTest().get_const_ptr();
514  const Real* cpen = thesolver->coWeights.get_const_ptr();
515  Real leastBest = infinity;
516  Real x;
517  int enterIdx = -1;
518  int idx;
519 
520  // find the best price from short candidate list
521  for( int i = bestPrices.size() - 1; i >= 0; --i )
522  {
523  idx = bestPrices.index(i);
524  x = cTest[idx];
525  if( x < -feastol )
526  {
527  x = computePrice(x, cpen[idx], feastol);
528  if( x > best )
529  {
530  best = x;
531  enterIdx = idx;
532  last = cpen[idx];
533  }
534  if( x < leastBest )
535  leastBest = x;
536  }
537  else
538  {
539  bestPrices.remove(i);
541  }
542  }
543 
544  // make sure we do not skip potential candidates due to a high leastBest value
545  if( leastBest == infinity )
546  {
547  assert(bestPrices.size() == 0);
548  leastBest = 0;
549  }
550 
551  // scan the updated indeces for a better price
552  for( int i = thesolver->updateViols.size() -1; i >= 0; --i )
553  {
554  idx = thesolver->updateViols.index(i);
555  // only look at indeces that were not checked already
556  if( thesolver->isInfeasible[idx] == VIOLATED )
557  {
558  x = cTest[idx];
559  if( x < -feastol )
560  {
561  x = computePrice(x, cpen[idx], feastol);
562  if(x > leastBest)
563  {
564  if( x > best )
565  {
566  best = x;
567  enterIdx = idx;
568  last = cpen[idx];
569  }
570  // put index into candidate list
572  bestPrices.addIdx(idx);
573  }
574  }
575  else
576  {
578  }
579  }
580  }
581 
582  if (enterIdx >= 0)
583  return thesolver->coId(enterIdx);
584  else
585  return SPxId();
586 }
587 
588 
590 {
591  const Real* test = thesolver->test().get_const_ptr();
592  const Real* pen = thesolver->weights.get_const_ptr();
593  Real leastBest = infinity;
594  Real x;
595  int enterIdx = -1;
596  int idx;
597 
598  // find the best price from short candidate list
599  for( int i = bestPricesCo.size() - 1; i >= 0; --i )
600  {
601  idx = bestPricesCo.index(i);
602  x = test[idx];
603  if( x < -feastol )
604  {
605  x = computePrice(x, pen[idx], feastol);
606  if( x > best )
607  {
608  best = x;
609  enterIdx = idx;
610  last = pen[idx];
611  }
612  if( x < leastBest )
613  leastBest = x;
614  }
615  else
616  {
617  bestPricesCo.remove(i);
619  }
620  }
621  // make sure we do not skip potential candidates due to a high leastBest value
622  if( leastBest == infinity )
623  {
624  assert(bestPricesCo.size() == 0);
625  leastBest = 0;
626  }
627 
628  //scan the updated indeces for a better price
629  for( int i = thesolver->updateViolsCo.size() -1; i >= 0; --i )
630  {
631  idx = thesolver->updateViolsCo.index(i);
632  // only look at indeces that were not checked already
633  if( thesolver->isInfeasibleCo[idx] == VIOLATED )
634  {
635  x = test[idx];
636  if( x < -feastol )
637  {
638  x = computePrice(x, pen[idx], feastol);
639  if( x > leastBest )
640  {
641  if( x > best )
642  {
643  best = x;
644  enterIdx = idx;
645  last = pen[idx];
646  }
647  // put index into candidate list
649  bestPricesCo.addIdx(idx);
650  }
651  }
652  else
653  {
655  }
656  }
657  }
658 
659  if( enterIdx >= 0 )
660  return thesolver->id(enterIdx);
661  else
662  return SPxId();
663 }
664 
665 
667 {
668  const Real* cTest = thesolver->coTest().get_const_ptr();
669  const Real* cpen = thesolver->coWeights.get_const_ptr();
670  int enterIdx = -1;
671  int idx;
672  Real x;
673 
674  assert(thesolver->coWeights.dim() == thesolver->coTest().dim());
675  for(int i = thesolver->infeasibilities.size() -1; i >= 0; --i)
676  {
677  idx = thesolver->infeasibilities.index(i);
678  x = cTest[idx];
679  if( x < -feastol )
680  {
681  x = computePrice(x, cpen[idx], feastol);
682  if (x > best)
683  {
684  best = x;
685  enterIdx = idx;
686  last = cpen[idx];
687  }
688  }
689  else
690  {
693  }
694  }
695  if (enterIdx >= 0)
696  return thesolver->coId(enterIdx);
697 
698  return SPxId();
699 }
700 
701 
703 {
704  const Real* test = thesolver->test().get_const_ptr();
705  const Real* pen = thesolver->weights.get_const_ptr();
706  int enterIdx = -1;
707  int idx;
708  Real x;
709 
710  assert(thesolver->weights.dim() == thesolver->test().dim());
711  for (int i = thesolver->infeasibilitiesCo.size() -1; i >= 0; --i)
712  {
714  x = test[idx];
715  if (x < -feastol)
716  {
717  x = computePrice(x, pen[idx], feastol);
718  if (x > best)
719  {
720  best = x;
721  enterIdx = idx;
722  last = pen[idx];
723  }
724  }
725  else
726  {
729  }
730  }
731 
732  if (enterIdx >= 0)
733  return thesolver->id(enterIdx);
734 
735  return SPxId();
736 }
737 
738 
739 SPxId SPxDevexPR::selectEnterDenseDim(Real& best, Real feastol, int start, int incr)
740 {
741  const Real* cTest = thesolver->coTest().get_const_ptr();
742  const Real* cpen = thesolver->coWeights.get_const_ptr();
743  int end = thesolver->coWeights.dim();
744  int enterIdx = -1;
745  Real x;
746 
747  assert(end == thesolver->coTest().dim());
748  for (; start < end; start += incr)
749  {
750  x = cTest[start];
751  if( x < -feastol )
752  {
753  x = computePrice(x, cpen[start], feastol);
754  if (x > best)
755  {
756  best = x;
757  enterIdx = start;
758  last = cpen[start];
759  }
760  }
761  }
762 
763  if (enterIdx >= 0)
764  return thesolver->coId(enterIdx);
765 
766  return SPxId();
767 }
768 
769 
770 SPxId SPxDevexPR::selectEnterDenseCoDim(Real& best, Real feastol, int start, int incr)
771 {
772  const Real* test = thesolver->test().get_const_ptr();
773  const Real* pen = thesolver->weights.get_const_ptr();
774  int end = thesolver->weights.dim();
775  int enterIdx = -1;
776  Real x;
777 
778  assert(end == thesolver->test().dim());
779  for (; start < end; start += incr)
780  {
781  x = test[start];
782  if (test[start] < -feastol)
783  {
784  x = computePrice(x, pen[start], feastol);
785  if (x > best)
786  {
787  best = x;
788  enterIdx = start;
789  last = pen[start];
790  }
791  }
792  }
793 
794  if (enterIdx >= 0)
795  return thesolver->id(enterIdx);
796 
797  return SPxId();
798 }
799 
800 
801 /**@todo suspicious: the pricer should be informed, that variable id
802  has entered the basis at position n, but the id is not used here
803  (this is true for all pricers)
804 */
805 void SPxDevexPR::entered4(SPxId /*id*/, int n)
806 {
807  DVector& weights = thesolver->weights;
808  DVector& coWeights = thesolver->coWeights;
809 
810  if (n >= 0 && n < thesolver->dim())
811  {
812  const Real* pVec = thesolver->pVec().delta().values();
813  const IdxSet& pIdx = thesolver->pVec().idx();
814  const Real* coPvec = thesolver->coPvec().delta().values();
815  const IdxSet& coPidx = thesolver->coPvec().idx();
816  Real xi_p = 1 / thesolver->fVec().delta()[n];
817  int i, j;
818 
819  assert(thesolver->fVec().delta()[n] > thesolver->epsilon()
820  || thesolver->fVec().delta()[n] < -thesolver->epsilon());
821 
822  xi_p = xi_p * xi_p * last;
823 
824  for (j = coPidx.size() - 1; j >= 0; --j)
825  {
826  i = coPidx.index(j);
827  coWeights[i] += xi_p * coPvec[i] * coPvec[i];
828  if (coWeights[i] <= 1 || coWeights[i] > 1e+6)
829  {
831  return;
832  }
833  }
834 
835  for (j = pIdx.size() - 1; j >= 0; --j)
836  {
837  i = pIdx.index(j);
838  weights[i] += xi_p * pVec[i] * pVec[i];
839  if (weights[i] <= 1 || weights[i] > 1e+6)
840  {
842  return;
843  }
844  }
845  }
846 }
847 
849 {
850  int initval = (thesolver->type() == SPxSolver::ENTER) ? 2 : 1;
851  DVector& weights = thesolver->weights;
852  n = weights.dim();
853  weights.reDim (thesolver->coDim());
854  for( int i = weights.dim()-1; i >= n; --i )
855  weights[i] = initval;
856 }
857 
859 {
860  int initval = (thesolver->type() == SPxSolver::ENTER) ? 2 : 1;
861  DVector& coWeights = thesolver->coWeights;
862  n = coWeights.dim();
863  coWeights.reDim(thesolver->dim());
864  for( int i = coWeights.dim()-1; i >= n; --i )
865  coWeights[i] = initval;
866 }
867 
868 } // namespace soplex
Rational spxAbs(const Rational &r)
Absolute.
Definition: rational.cpp:3909
SPxId coId(int i) const
id of i &#39;th covector.
Definition: spxsolver.h:1098
virtual SPxId selectEnter()
Definition: spxdevexpr.cpp:453
DIdxSet bestPricesCo
set of best pricing candidates
Definition: spxdevexpr.h:54
void reDim(int newdim, const bool setZero=true)
Resets DVectorBase&#39;s dimension to newdim.
Definition: dvectorbase.h:249
SPxId buildBestPriceVectorEnterCoDim(Real &best, Real feastol)
Definition: spxdevexpr.cpp:403
const Vector & fTest() const
Violations of fVec.
Definition: spxsolver.h:1366
DIdxSet updateViols
store indices that were changed in the previous iteration and must be checked in hyper pricing ...
Definition: spxsolver.h:410
SPxOut * spxout
message handler
Definition: spxsolver.h:436
bool sparsePricingLeave
These values enable or disable sparse pricing.
Definition: spxsolver.h:421
THREADLOCAL const Real infinity
Definition: spxdefines.cpp:26
Type
Algorithmic type.
Definition: spxsolver.h:124
DataArray< IdxElement > pricesCo
temporary array of precomputed pricing values
Definition: spxdevexpr.h:52
virtual bool isConsistent() const
consistency check
Definition: spxdevexpr.cpp:31
#define DEVEX_REFINETOL
Definition: spxdevexpr.cpp:19
T * get_ptr()
get a C pointer to the data.
Definition: dataarray.h:110
Representation
LP basis representation.
Definition: spxsolver.h:105
bool sparsePricingEnterCo
true if sparsePricing is turned on in the entering Simplex
Definition: spxsolver.h:423
Real computePrice(Real viol, Real weight, Real tol)
Definition: spxdevexpr.cpp:104
DataArray< int > isInfeasible
0: index not violated, 1: index violated, 2: index violated and among candidate list ...
Definition: spxsolver.h:417
virtual void left4(int n, SPxId id)
Definition: spxdevexpr.cpp:319
SPxId selectEnterDenseCoDim(Real &best, Real feastol, int start=0, int incr=1)
SPxPricer::selectEnter() in dense case.
Definition: spxdevexpr.cpp:770
void clear()
removes all indices.
Definition: idxset.h:184
int lastUpdate() const
returns number of basis changes since last refactorization.
Definition: spxbasis.h:539
int dim() const
dimension of basis matrix.
Definition: spxsolver.h:1056
void clear()
remove all elements.
Definition: dataarray.h:205
SPxId buildBestPriceVectorEnterDim(Real &best, Real feastol)
build up vector of pricing values for later use
Definition: spxdevexpr.cpp:353
Devex pricer.
Real last
penalty, selected at last iteration.
Definition: spxdevexpr.h:50
SPxId selectEnterSparseCoDim(Real &best, Real feastol)
implementation of sparse pricing in the entering Simplex
Definition: spxdevexpr.cpp:702
int buildBestPriceVectorLeave(Real feastol)
build up vector of pricing values for later use
Definition: spxdevexpr.cpp:113
const R * get_const_ptr() const
Conversion to C-style pointer.
Definition: vectorbase.h:453
Entering Simplex.
Definition: spxsolver.h:134
Generic Ids for LP rows or columns.Both SPxColIds and SPxRowIds may be treated uniformly as SPxIds: ...
Definition: spxid.h:85
UpdateVector & coPvec() const
copricing vector.
Definition: spxsolver.h:1379
void remove(int n, int m)
removes indices at position numbers n through m.
Definition: idxset.cpp:49
DataArray< IdxElement > prices
temporary array of precomputed pricing values
Definition: spxdevexpr.h:51
double Real
Definition: spxdefines.h:218
int selectLeaveSparse(Real feastol)
implementation of sparse pricing in the leaving Simplex
Definition: spxdevexpr.cpp:214
const R * values() const
Returns array values.
Definition: ssvectorbase.h:299
virtual void setType(SPxSolver::Type)
set entering/leaving algorithm
Definition: spxdevexpr.cpp:71
virtual void setRep(SPxSolver::Representation)
set row/column representation
Definition: spxdevexpr.cpp:93
#define HYPERPRICINGSIZE
Definition: spxsolver.h:38
int size() const
returns the number of used indices.
Definition: idxset.h:124
void setupWeights(SPxSolver::Type)
set entering/leaving algorithm
Definition: spxdevexpr.cpp:43
void append(const T &t)
append element t.
Definition: dataarray.h:121
SPxId id(int i) const
id of i &#39;th vector.
Definition: spxsolver.h:1079
UpdateVector & fVec() const
feasibility vector.
Definition: spxsolver.h:1304
void addIdx(int i)
adds index i to the index set
Definition: didxset.h:75
const T * get_const_ptr() const
get a const C pointer to the data.
Definition: dataarray.h:115
DVector coWeights
store dual norms
Definition: spxsolver.h:433
SPxSolver * thesolver
the solver
Definition: spxpricer.h:56
SPxId selectEnterHyperCoDim(Real &best, Real feastol)
implementation of hyper sparse pricing in the entering Simplex
Definition: spxdevexpr.cpp:589
bool sparsePricingEnter
true if sparsePricing is turned on in the entering Simplex for slack variables
Definition: spxsolver.h:422
const Vector & test() const
Violations of pVec.
Definition: spxsolver.h:1512
DIdxSet bestPrices
set of best pricing candidates
Definition: spxdevexpr.h:53
#define MSG_INFO3(spxout, x)
Prints out message x if the verbosity level is at least SPxOut::INFO3.
Definition: spxdefines.h:122
Real epsilon() const
values are considered to be 0.
Definition: spxsolver.h:767
Debugging, floating point type and parameter definitions.
Sequential object-oriented SimPlex.SPxSolver is an LP solver class using the revised Simplex algorith...
Definition: spxsolver.h:84
UpdateVector & pVec() const
pricing vector.
Definition: spxsolver.h:1459
DIdxSet infeasibilities
Definition: spxsolver.h:404
R length2() const
Squared euclidian norm.
Definition: ssvectorbase.h:532
int dim() const
Dimension of vector.
Definition: vectorbase.h:215
Everything should be within this namespace.
const IdxSet & idx() const
nonzero indices of update vector
Definition: updatevector.h:133
IdxCompare compare
Definition: spxpricer.h:88
int selectLeaveHyper(Real feastol)
implementation of hyper sparse pricing in the leaving Simplex
Definition: spxdevexpr.cpp:248
virtual int selectLeave()
Definition: spxdevexpr.cpp:157
bool refined
has a refinement step already been tried?
Definition: spxdevexpr.h:55
#define SPARSITY_TRADEOFF
Definition: spxsolver.h:41
int SPxQuicksortPart(T *keys, COMPARATOR &compare, int start, int end, int size, int start2=0, int end2=0, bool type=true)
Generic implementation of Partial QuickSort.
Definition: sorter.h:219
SPxId selectEnterHyperDim(Real &best, Real feastol)
implementation of hyper sparse pricing in the entering Simplex
Definition: spxdevexpr.cpp:511
Real theeps
violation bound
Definition: spxpricer.h:58
const Vector & coTest() const
violations of coPvec.
Definition: spxsolver.h:1446
int selectLeaveX(Real feastol, int start=0, int incr=1)
internal implementation of SPxPricer::selectLeave()
Definition: spxdevexpr.cpp:188
bool isValid() const
returns TRUE iff the id is a valid column or row identifier.
Definition: spxid.h:150
virtual void entered4(SPxId id, int n)
Definition: spxdevexpr.cpp:805
int size() const
return nr. of elements.
Definition: dataarray.h:211
Type type() const
return current Type.
Definition: spxsolver.h:484
DataArray< int > isInfeasibleCo
0: index not violated, 1: index violated, 2: index violated and among candidate list ...
Definition: spxsolver.h:418
int coDim() const
codimension.
Definition: spxsolver.h:1061
bool hyperPricingEnter
true if hyper sparse pricing is turned on in the entering Simplex
Definition: spxsolver.h:425
virtual void addedCoVecs(int n)
n covectors have been added to loaded LP.
Definition: spxdevexpr.cpp:858
DVector weights
dual pricing norms
Definition: spxsolver.h:432
#define MSGinconsistent(name)
Definition: spxdefines.h:126
bool weightsAreSetup
are the dual norms already set up?
Definition: spxsolver.h:434
virtual void load(SPxSolver *base)
sets the solver
Definition: spxdevexpr.cpp:24
SSVector & delta()
update vector , writeable
Definition: updatevector.h:122
DIdxSet updateViolsCo
Definition: spxsolver.h:411
void reMax(int newMax=1, int newSize=-1)
reset maximum number of elements.
Definition: dataarray.h:254
SPxId selectEnterSparseDim(Real &best, Real feastol)
implementation of sparse pricing in the entering Simplex (slack variables)
Definition: spxdevexpr.cpp:666
int index(int n) const
access n &#39;th index.
Definition: idxset.h:118
SPxId selectEnterDenseDim(Real &best, Real feastol, int start=0, int incr=1)
SPxPricer::selectEnter() in dense case (slack variabels)
Definition: spxdevexpr.cpp:739
void setMax(int newmax=1)
sets the maximum number of indices.
Definition: didxset.cpp:22
const SPxBasis & basis() const
Return current basis.
Definition: spxsolver.h:1736
DIdxSet infeasibilitiesCo
Definition: spxsolver.h:407
bool hyperPricingLeave
true if hyper sparse pricing is turned on in the leaving Simplex
Definition: spxsolver.h:424
const IdxElement * elements
Definition: spxpricer.h:77
Representation rep() const
return the current basis representation.
Definition: spxsolver.h:478
Set of indices.Class IdxSet provides a set of indices. At construction it must be given an array of i...
Definition: idxset.h:56
virtual void addedVecs(int n)
n vectors have been added to loaded LP.
Definition: spxdevexpr.cpp:848
SPxId selectEnterX(Real tol)
choose the best entering index among columns and rows but prefer sparsity
Definition: spxdevexpr.cpp:472