Scippy

SoPlex

Sequential object-oriented simPlex

leave.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-2019 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 /* Updating the Basis for Leaving Variables
17  */
18 #include <assert.h>
19 #include <stdio.h>
20 
21 #include "soplex/spxdefines.h"
22 #include "soplex/spxpricer.h"
23 #include "soplex/spxsolver.h"
24 #include "soplex/spxratiotester.h"
25 #include "soplex/spxout.h"
26 #include "soplex/exceptions.h"
27 #include "soplex/stablesum.h"
28 
29 namespace soplex
30 {
31 static const Real reject_leave_tol = 1e-10; // = LOWSTAB as defined in spxfastrt.cpp
32 
33 /*
34  Vector |fTest| gives the feasibility test of all basic variables. For its
35  computation |fVec|, |theUBbound| and |theLBbound| must be setup correctly.
36  Values of |fTest| $<0$ represent infeasible variables, which are eligible
37  for leaving the basis in the simplex loop.
38  */
40 {
41 
42  assert(type() == LEAVE);
43 
44  Real theeps = entertol();
45  m_pricingViolUpToDate = true;
47  m_pricingViol = 0;
48  m_pricingViolCo = 0;
50  int ninfeasibilities = 0;
51  int sparsitythreshold = (int)(sparsePricingFactor * dim());
52 
53  for(int i = 0; i < dim(); ++i)
54  {
55  theCoTest[i] = ((*theFvec)[i] > theUBbound[i])
56  ? theUBbound[i] - (*theFvec)[i]
57  : (*theFvec)[i] - theLBbound[i];
58 
59  if(remainingRoundsLeave == 0)
60  {
61  if(theCoTest[i] < -theeps)
62  {
66  ++ninfeasibilities;
67  }
68  else
70 
71  if(ninfeasibilities > sparsitythreshold)
72  {
73  MSG_INFO2((*spxout), (*spxout) << " --- using dense pricing"
74  << std::endl;)
76  sparsePricingLeave = false;
77  ninfeasibilities = 0;
78  }
79  }
80  else if(theCoTest[i] < -theeps)
82  }
83 
84  if(ninfeasibilities == 0 && !sparsePricingLeave)
85  {
87  }
88  else if(ninfeasibilities <= sparsitythreshold && !sparsePricingLeave)
89  {
90  MSG_INFO2((*spxout),
91  std::streamsize prec = spxout->precision();
92 
94  (*spxout) << " --- using hypersparse pricing, ";
95  else
96  (*spxout) << " --- using sparse pricing, ";
97  (*spxout) << "sparsity: "
98  << std::setw(6) << std::fixed << std::setprecision(4)
99  << (Real) ninfeasibilities / dim()
100  << std::scientific << std::setprecision(int(prec))
101  << std::endl;
102  )
103  sparsePricingLeave = true;
104  }
105 }
106 
108 {
109  const IdxSet& idx = theFvec->idx();
110  Vector& ftest = theCoTest; // |== fTest()|
111  assert(&ftest == &fTest());
112 
113  assert(type() == LEAVE);
114 
115  updateViols.clear();
116  Real theeps = entertol();
117 
118  for(int j = idx.size() - 1; j >= 0; --j)
119  {
120  int i = idx.index(j);
121 
122  if(m_pricingViolUpToDate && ftest[i] < -theeps)
123  m_pricingViol += ftest[i];
124 
125  ftest[i] = ((*theFvec)[i] > theUBbound[i])
126  ? theUBbound[i] - (*theFvec)[i]
127  : (*theFvec)[i] - theLBbound[i];
128 
129 
130  if(sparsePricingLeave && ftest[i] < -theeps)
131  {
132  assert(remainingRoundsLeave == 0);
133 
135  m_pricingViol -= ftest[i];
136 
138  {
139  // this can cause problems - we cannot keep on adding indeces to infeasibilities,
140  // because they are not deleted in hyper mode...
141  // if( !hyperPricingLeave )
144  }
145 
147  updateViols.addIdx(i);
148  }
149  else if(m_pricingViolUpToDate && ftest[i] < -theeps)
150  m_pricingViol -= ftest[i];
151 
152  }
153 
154  // if boundflips were performed, we need to update these indices as well
155  if(boundflips > 0)
156  {
157  Real eps = epsilon();
158 
159  for(int j = 0; j < solveVector3->size(); ++j)
160  {
161  if(spxAbs(solveVector3->value(j)) > eps)
162  {
163  int i = solveVector3->index(j);
164 
165  if(m_pricingViolUpToDate && ftest[i] < -theeps)
166  m_pricingViol += ftest[i];
167 
168  ftest[i] = ((*theFvec)[i] > theUBbound[i]) ? theUBbound[i] - (*theFvec)[i] :
169  (*theFvec)[i] - theLBbound[i];
170 
171  if(sparsePricingLeave && ftest[i] < -theeps)
172  {
173  assert(remainingRoundsLeave == 0);
174 
176  m_pricingViol -= ftest[i];
177 
178  if(!isInfeasible[i])
179  {
181  isInfeasible[i] = true;
182  }
183  }
184  else if(m_pricingViolUpToDate && ftest[i] < -theeps)
185  m_pricingViol -= ftest[i];
186  }
187  }
188  }
189 }
190 
191 
192 /* compute statistics on leaving variable
193  Compute a set of statistical values on the variable selected for leaving the
194  basis.
195  */
197  int leaveIdx,
198  SPxBasis::Desc::Status& leaveStat,
199  SPxId& leaveId,
200  Real& leaveMax,
201  Real& leavebound,
202  int& leaveNum,
203  StableSum<Real>& objChange)
204 {
205  SPxBasis::Desc& ds = desc();
206  leaveId = baseId(leaveIdx);
207 
208  if(leaveId.isSPxRowId())
209  {
210  leaveNum = number(SPxRowId(leaveId));
211  leaveStat = ds.rowStatus(leaveNum);
212 
213  assert(isBasic(leaveStat));
214 
215  switch(leaveStat)
216  {
218  assert(rep() == ROW);
219  ds.rowStatus(leaveNum) = dualRowStatus(leaveNum);
220  leavebound = 0;
221  leaveMax = -infinity;
222  break;
223 
225  assert(rep() == ROW);
226  ds.rowStatus(leaveNum) = dualRowStatus(leaveNum);
227  leavebound = 0;
228  leaveMax = infinity;
229  break;
230 
232  assert(rep() == ROW);
233  throw SPxInternalCodeException("XLEAVE01 This should never happen.");
234 
236  assert(rep() == COLUMN);
237  ds.rowStatus(leaveNum) = SPxBasis::Desc::P_FIXED;
238  assert(lhs(leaveNum) == rhs(leaveNum));
239  leavebound = -rhs(leaveNum);
240 
241  if((*theFvec)[leaveIdx] < theLBbound[leaveIdx])
242  leaveMax = infinity;
243  else
244  leaveMax = -infinity;
245 
246  break;
247 
249  assert(rep() == COLUMN);
250  ds.rowStatus(leaveNum) = SPxBasis::Desc::P_ON_UPPER;
251  leavebound = -rhs(leaveNum); // slack !!
252  leaveMax = infinity;
253  objChange += theLRbound[leaveNum] * rhs(leaveNum);
254  break;
255 
257  assert(rep() == COLUMN);
258  ds.rowStatus(leaveNum) = SPxBasis::Desc::P_ON_LOWER;
259  leavebound = -lhs(leaveNum); // slack !!
260  leaveMax = -infinity;
261  objChange += theURbound[leaveNum] * lhs(leaveNum);
262  break;
263 
265  assert(rep() == COLUMN);
266 
267  if((*theFvec)[leaveIdx] > theLBbound[leaveIdx])
268  {
269  ds.rowStatus(leaveNum) = SPxBasis::Desc::P_ON_LOWER;
270  theLRbound[leaveNum] = -infinity;
271  leavebound = -lhs(leaveNum); // slack !!
272  leaveMax = -infinity;
273  objChange += theURbound[leaveNum] * lhs(leaveNum);
274  }
275  else
276  {
277  ds.rowStatus(leaveNum) = SPxBasis::Desc::P_ON_UPPER;
278  theURbound[leaveNum] = infinity;
279  leavebound = -rhs(leaveNum); // slack !!
280  leaveMax = infinity;
281  objChange += theLRbound[leaveNum] * rhs(leaveNum);
282  }
283 
284  break;
285 
286  default:
287  throw SPxInternalCodeException("XLEAVE02 This should never happen.");
288  }
289 
290  MSG_DEBUG(std::cout << "DLEAVE51 SPxSolver::getLeaveVals() : row " << leaveNum
291  << ": " << leaveStat
292  << " -> " << ds.rowStatus(leaveNum)
293  << " objChange: " << objChange
294  << std::endl;)
295  }
296 
297  else
298  {
299  assert(leaveId.isSPxColId());
300  leaveNum = number(SPxColId(leaveId));
301  leaveStat = ds.colStatus(leaveNum);
302 
303  assert(isBasic(leaveStat));
304 
305  switch(leaveStat)
306  {
308  assert(rep() == ROW);
309  ds.colStatus(leaveNum) = dualColStatus(leaveNum);
310  leavebound = 0;
311  leaveMax = -infinity;
312  break;
313 
315  assert(rep() == ROW);
316  ds.colStatus(leaveNum) = dualColStatus(leaveNum);
317  leavebound = 0;
318  leaveMax = infinity;
319  break;
320 
322  assert(rep() == ROW);
323  ds.colStatus(leaveNum) = dualColStatus(leaveNum);
324 
325  if((*theFvec)[leaveIdx] < theLBbound[leaveIdx])
326  {
327  leavebound = theLBbound[leaveIdx];
328  leaveMax = -infinity;
329  }
330  else
331  {
332  leavebound = theUBbound[leaveIdx];
333  leaveMax = infinity;
334  }
335 
336  break;
337 
339  assert(rep() == COLUMN);
340  assert(SPxLP::upper(leaveNum) == SPxLP::lower(leaveNum));
341  ds.colStatus(leaveNum) = SPxBasis::Desc::P_FIXED;
342  leavebound = SPxLP::upper(leaveNum);
343  objChange += maxObj(leaveNum) * leavebound;
344 
345  if((*theFvec)[leaveIdx] < theLBbound[leaveIdx])
346  leaveMax = infinity;
347  else
348  leaveMax = -infinity;
349 
350  break;
351 
353  assert(rep() == COLUMN);
354  ds.colStatus(leaveNum) = SPxBasis::Desc::P_ON_UPPER;
355  leavebound = SPxLP::upper(leaveNum);
356  objChange += theUCbound[leaveNum] * leavebound;
357  leaveMax = -infinity;
358  break;
359 
361  assert(rep() == COLUMN);
362  ds.colStatus(leaveNum) = SPxBasis::Desc::P_ON_LOWER;
363  leavebound = SPxLP::lower(leaveNum);
364  objChange += theLCbound[leaveNum] * leavebound;
365  leaveMax = infinity;
366  break;
367 
369  assert(rep() == COLUMN);
370 
371  if((*theFvec)[leaveIdx] > theUBbound[leaveIdx])
372  {
373  leaveMax = -infinity;
374  leavebound = SPxLP::upper(leaveNum);
375  objChange += theUCbound[leaveNum] * leavebound;
376  theLCbound[leaveNum] = -infinity;
377  ds.colStatus(leaveNum) = SPxBasis::Desc::P_ON_UPPER;
378  }
379  else
380  {
381  leaveMax = infinity;
382  leavebound = SPxLP::lower(leaveNum);
383  objChange += theLCbound[leaveNum] * leavebound;
384  theUCbound[leaveNum] = infinity;
385  ds.colStatus(leaveNum) = SPxBasis::Desc::P_ON_LOWER;
386  }
387 
388  break;
389 
390  default:
391  throw SPxInternalCodeException("XLEAVE03 This should never happen.");
392  }
393 
394  MSG_DEBUG(std::cout << "DLEAVE52 SPxSolver::getLeaveVals() : col " << leaveNum
395  << ": " << leaveStat
396  << " -> " << ds.colStatus(leaveNum)
397  << " objChange: " << objChange
398  << std::endl;)
399  }
400 }
401 
403  Real leaveMax,
404  SPxId enterId,
405  Real& enterBound,
406  Real& newUBbound,
407  Real& newLBbound,
408  Real& newCoPrhs,
409  StableSum<Real>& objChange
410 )
411 {
412  SPxBasis::Desc& ds = desc();
413 
414  enterBound = 0;
415 
416  if(enterId.isSPxRowId())
417  {
418  int idx = number(SPxRowId(enterId));
419  SPxBasis::Desc::Status enterStat = ds.rowStatus(idx);
420 
421  switch(enterStat)
422  {
424  assert(rep() == ROW);
425 
426  if(thePvec->delta()[idx] * leaveMax < 0)
427  newCoPrhs = theLRbound[idx];
428  else
429  newCoPrhs = theURbound[idx];
430 
431  newUBbound = infinity;
432  newLBbound = -infinity;
434  break;
435 
437  assert(rep() == ROW);
438  newUBbound = 0;
439  newLBbound = -infinity;
441  newCoPrhs = theLRbound[idx];
442  break;
443 
445  assert(rep() == ROW);
446  newUBbound = infinity;
447  newLBbound = 0;
449  newCoPrhs = theURbound[idx];
450  break;
451 
453  assert(rep() == ROW);
454 
455  if(leaveMax * thePvec->delta()[idx] < 0)
456  {
457  newUBbound = 0;
458  newLBbound = -infinity;
460  newCoPrhs = theLRbound[idx];
461  }
462  else
463  {
464  newUBbound = infinity;
465  newLBbound = 0;
467  newCoPrhs = theURbound[idx];
468  }
469 
470  break;
471 
473  assert(rep() == COLUMN);
474  ds.rowStatus(idx) = dualRowStatus(idx);
475 
476  if(lhs(idx) > -infinity)
477  theURbound[idx] = theLRbound[idx];
478 
479  newCoPrhs = theLRbound[idx]; // slack !!
480  newUBbound = -lhs(idx);
481  newLBbound = -rhs(idx);
482  enterBound = -rhs(idx);
483  objChange -= newCoPrhs * rhs(idx);
484  break;
485 
487  assert(rep() == COLUMN);
488  ds.rowStatus(idx) = dualRowStatus(idx);
489 
490  if(rhs(idx) < infinity)
491  theLRbound[idx] = theURbound[idx];
492 
493  newCoPrhs = theURbound[idx]; // slack !!
494  newLBbound = -rhs(idx);
495  newUBbound = -lhs(idx);
496  enterBound = -lhs(idx);
497  objChange -= newCoPrhs * lhs(idx);
498  break;
499 
501  assert(rep() == COLUMN);
502 #if 1
503  throw SPxInternalCodeException("XLEAVE04 This should never happen.");
504 #else
505  MSG_ERROR(std::cerr << "ELEAVE53 ERROR: not yet debugged!" << std::endl;)
506  ds.rowStatus(idx) = dualRowStatus(idx);
507  newCoPrhs = theURbound[idx]; // slack !!
508  newUBbound = infinity;
509  newLBbound = -infinity;
510  enterBound = 0;
511 #endif
512  break;
513 
515  assert(rep() == COLUMN);
516  MSG_ERROR(std::cerr << "ELEAVE54 "
517  << "ERROR! Tried to put a fixed row variable into the basis: "
518  << "idx=" << idx
519  << ", lhs=" << lhs(idx)
520  << ", rhs=" << rhs(idx) << std::endl;)
521  throw SPxInternalCodeException("XLEAVE05 This should never happen.");
522 
523  default:
524  throw SPxInternalCodeException("XLEAVE06 This should never happen.");
525  }
526 
527  MSG_DEBUG(std::cout << "DLEAVE55 SPxSolver::getLeaveVals2(): row " << idx
528  << ": " << enterStat
529  << " -> " << ds.rowStatus(idx)
530  << " objChange: " << objChange
531  << std::endl;)
532  }
533 
534  else
535  {
536  assert(enterId.isSPxColId());
537  int idx = number(SPxColId(enterId));
538  SPxBasis::Desc::Status enterStat = ds.colStatus(idx);
539 
540  switch(enterStat)
541  {
543  assert(rep() == ROW);
544  newUBbound = 0;
545  newLBbound = -infinity;
547  newCoPrhs = theLCbound[idx];
548  break;
549 
551  assert(rep() == ROW);
552  newUBbound = infinity;
553  newLBbound = 0;
555  newCoPrhs = theUCbound[idx];
556  break;
557 
559  assert(rep() == ROW);
560  newUBbound = infinity;
561  newLBbound = -infinity;
562  newCoPrhs = theLCbound[idx];
564  break;
565 
567  assert(rep() == ROW);
568 
569  if(leaveMax * theCoPvec->delta()[idx] < 0)
570  {
571  newUBbound = 0;
572  newLBbound = -infinity;
574  newCoPrhs = theLCbound[idx];
575  }
576  else
577  {
578  newUBbound = infinity;
579  newLBbound = 0;
581  newCoPrhs = theUCbound[idx];
582  }
583 
584  break;
585 
587  assert(rep() == COLUMN);
588  ds.colStatus(idx) = dualColStatus(idx);
589 
590  if(SPxLP::lower(idx) > -infinity)
591  theLCbound[idx] = theUCbound[idx];
592 
593  newCoPrhs = theUCbound[idx];
594  newUBbound = SPxLP::upper(idx);
595  newLBbound = SPxLP::lower(idx);
596  enterBound = SPxLP::upper(idx);
597  objChange -= newCoPrhs * enterBound;
598  break;
599 
601  assert(rep() == COLUMN);
602  ds.colStatus(idx) = dualColStatus(idx);
603 
604  if(SPxLP::upper(idx) < infinity)
605  theUCbound[idx] = theLCbound[idx];
606 
607  newCoPrhs = theLCbound[idx];
608  newUBbound = SPxLP::upper(idx);
609  newLBbound = SPxLP::lower(idx);
610  enterBound = SPxLP::lower(idx);
611  objChange -= newCoPrhs * enterBound;
612  break;
613 
615  assert(rep() == COLUMN);
616  ds.colStatus(idx) = dualColStatus(idx);
617 
618  if(thePvec->delta()[idx] * leaveMax > 0)
619  newCoPrhs = theUCbound[idx];
620  else
621  newCoPrhs = theLCbound[idx];
622 
623  newUBbound = SPxLP::upper(idx);
624  newLBbound = SPxLP::lower(idx);
625  enterBound = 0;
626  break;
627 
629  assert(rep() == COLUMN);
630  MSG_ERROR(std::cerr << "ELEAVE56 "
631  << "ERROR! Tried to put a fixed column variable into the basis. "
632  << "idx=" << idx
633  << ", lower=" << lower(idx)
634  << ", upper=" << upper(idx) << std::endl;)
635  throw SPxInternalCodeException("XLEAVE07 This should never happen.");
636 
637  default:
638  throw SPxInternalCodeException("XLEAVE08 This should never happen.");
639  }
640 
641  MSG_DEBUG(std::cout << "DLEAVE57 SPxSolver::getLeaveVals2(): col " << idx
642  << ": " << enterStat
643  << " -> " << ds.colStatus(idx)
644  << " objChange: " << objChange
645  << std::endl;)
646  }
647 
648 }
649 
651  int leaveNum,
652  SPxId leaveId,
653  SPxBasis::Desc::Status leaveStat,
654  const SVector* //newVec
655 )
656 {
657  SPxBasis::Desc& ds = desc();
658 
659  if(leaveId.isSPxRowId())
660  {
661  MSG_DEBUG(std::cout << "DLEAVE58 rejectLeave() : row " << leaveNum
662  << ": " << ds.rowStatus(leaveNum)
663  << " -> " << leaveStat << std::endl;)
664 
665  if(leaveStat == SPxBasis::Desc::D_ON_BOTH)
666  {
667  if(ds.rowStatus(leaveNum) == SPxBasis::Desc::P_ON_LOWER)
668  theLRbound[leaveNum] = theURbound[leaveNum];
669  else
670  theURbound[leaveNum] = theLRbound[leaveNum];
671  }
672 
673  ds.rowStatus(leaveNum) = leaveStat;
674  }
675  else
676  {
677  MSG_DEBUG(std::cout << "DLEAVE59 rejectLeave() : col " << leaveNum
678  << ": " << ds.colStatus(leaveNum)
679  << " -> " << leaveStat << std::endl;)
680 
681  if(leaveStat == SPxBasis::Desc::D_ON_BOTH)
682  {
683  if(ds.colStatus(leaveNum) == SPxBasis::Desc::P_ON_UPPER)
684  theLCbound[leaveNum] = theUCbound[leaveNum];
685  else
686  theUCbound[leaveNum] = theLCbound[leaveNum];
687  }
688 
689  ds.colStatus(leaveNum) = leaveStat;
690  }
691 }
692 
693 
695 {
696  Real sign = (direction > 0 ? 1.0 : -1.0);
697 
698  primalRay.clear();
700 
701  for(int i = 0; i < coPvec().delta().size(); ++i)
702  primalRay.add(coPvec().delta().index(i), sign * coPvec().delta().value(i));
703 }
704 
706 {
707  Real sign = (direction > 0 ? -1.0 : 1.0);
708 
709  dualFarkas.clear();
711 
712  for(int i = 0; i < coPvec().delta().size(); ++i)
713  dualFarkas.add(coPvec().delta().index(i), sign * coPvec().delta().value(i));
714 }
715 
716 bool SPxSolver::leave(int leaveIdx, bool polish)
717 {
718  assert(leaveIdx < dim() && leaveIdx >= 0);
719  assert(type() == LEAVE);
720  assert(initialized);
721 
722  bool instable = instableLeave;
723  assert(!instable || instableLeaveNum >= 0);
724 
725  /*
726  Before performing the actual basis update, we must determine, how this
727  is to be accomplished.
728  When using steepest edge pricing this solve is already performed by the pricer
729  */
730  if(theCoPvec->delta().isSetup() && theCoPvec->delta().size() == 0)
731  {
732  coSolve(theCoPvec->delta(), unitVecs[leaveIdx]);
733  }
734 
735 #ifdef ENABLE_ADDITIONAL_CHECKS
736  else
737  {
738  SSVector tmp(dim(), epsilon());
739  tmp.clear();
740  coSolve(tmp, unitVecs[leaveIdx]);
741  tmp -= theCoPvec->delta();
742 
743  if(tmp.length() > leavetol())
744  {
745  // This happens very frequently and does usually not hurt, so print
746  // these warnings only with verbose level INFO2 and higher.
747  MSG_INFO2((*spxout), (*spxout) << "WLEAVE60 iteration=" << basis().iteration()
748  << ": coPvec.delta error = " << tmp.length()
749  << std::endl;)
750  }
751  }
752 
753 #endif // ENABLE_ADDITIONAL_CHECKS
754 
755  setupPupdate();
756 
757  assert(thePvec->isConsistent());
758  assert(theCoPvec->isConsistent());
759 
760  SPxBasis::Desc::Status leaveStat; // status of leaving var
761  SPxId leaveId; // id of leaving var
762  SPxId none; // invalid id used if leave fails
763  Real leaveMax; // maximium lambda of leaving var
764  Real leavebound; // current fVec value of leaving var
765  int leaveNum; // number of leaveId in bounds
766  StableSum<Real> objChange; // amount of change in the objective function
767 
768  getLeaveVals(leaveIdx, leaveStat, leaveId, leaveMax, leavebound, leaveNum, objChange);
769 
770  if(!polish && m_numCycle > m_maxCycle)
771  {
772  if(leaveMax > 0)
773  perturbMaxLeave();
774  else
775  perturbMinLeave();
776 
777  //@ m_numCycle /= 2;
778  // perturbation invalidates the currently stored nonbasic value
780  }
781 
782  //@ testBounds();
783 
784  Real enterVal = leaveMax;
785  boundflips = 0;
786  Real oldShift = theShift;
787  SPxId enterId = theratiotester->selectEnter(enterVal, leaveIdx, polish);
788 
789  if(NE(theShift, oldShift))
790  {
791  MSG_DEBUG(std::cout << "DLEAVE71 trigger recomputation of nonbasic value due to shifts in ratiotest"
792  << std::endl;)
794  }
795 
796  assert(!enterId.isValid() || !isBasic(enterId));
797 
798  instableLeaveNum = -1;
799  instableLeave = false;
800 
801  /*
802  No variable could be selected to enter the basis and even the leaving
803  variable is unbounded.
804  */
805  if(!enterId.isValid())
806  {
807  /* the following line originally was below in "rejecting leave" case;
808  we need it in the unbounded/infeasible case, too, to have the
809  correct basis size */
810  rejectLeave(leaveNum, leaveId, leaveStat);
811  change(-1, none, 0);
812  objChange = 0.0; // the nonbasicValue is not supposed to be updated in this case
813 
814  if(polish)
815  return false;
816 
817  if(NE(enterVal, leaveMax))
818  {
819  MSG_DEBUG(std::cout << "DLEAVE61 rejecting leave A (leaveIdx=" << leaveIdx
820  << ", theCoTest=" << theCoTest[leaveIdx] << ")"
821  << std::endl;)
822 
823  /* In the LEAVE algorithm, when for a selected leaving variable we find only
824  an instable entering variable, then the basis change is not conducted.
825  Instead, we save the leaving variable's index in instableLeaveNum and scale
826  theCoTest[leaveIdx] down by some factor, hoping to find a different leaving
827  variable with a stable entering variable.
828  If this fails, however, and no more leaving variable is found, we have to
829  perform the instable basis change using instableLeaveNum. In this (and only
830  in this) case, the flag instableLeave is set to true.
831 
832  enterVal != leaveMax is the case that selectEnter has found only an instable entering
833  variable. We store this leaving variable for later -- if we are not already in the
834  instable case: then we continue and conclude unboundedness/infeasibility */
835  if(!instable)
836  {
837  instableLeaveNum = leaveIdx;
838 
839  // Note: These changes do not survive a refactorization
840  instableLeaveVal = theCoTest[leaveIdx];
841  theCoTest[leaveIdx] = instableLeaveVal / 10.0;
842 
843  return true;
844  }
845  }
846 
847  if(lastUpdate() > 1)
848  {
849  MSG_INFO3((*spxout), (*spxout) << "ILEAVE01 factorization triggered in "
850  << "leave() for feasibility test" << std::endl;)
851 
852  try
853  {
854  factorize();
855  }
856  catch(const SPxStatusException& E)
857  {
858  // don't exit immediately but handle the singularity correctly
860  MSG_INFO3((*spxout), (*spxout) << "Caught exception in factorization: " << E.what() << std::endl;)
861  }
862 
863  /* after a factorization, the leaving column/row might not be infeasible or suboptimal anymore, hence we do
864  * not try to call leave(leaveIdx), but rather return to the main solving loop and call the pricer again
865  */
866  return true;
867  }
868 
869  /* do not exit with status infeasible or unbounded if there is only a very small violation */
870  if(!recomputedVectors && spxAbs(enterVal) < leavetol())
871  {
872  MSG_INFO3((*spxout), (*spxout) << "ILEAVE11 clean up step to reduce numerical errors" << std::endl;)
873 
874  computeFrhs();
876  computeFtest();
877 
878  /* only do this once per solve */
879  recomputedVectors = true;
880 
881  return true;
882  }
883 
884  MSG_INFO3((*spxout), (*spxout) << "ILEAVE02 unboundedness/infeasibility found "
885  << "in leave()" << std::endl;)
886 
887  if(rep() != COLUMN)
888  {
889  computePrimalray4Row(enterVal);
891  }
892  else
893  {
894  computeDualfarkas4Col(enterVal);
896  }
897 
898  return false;
899  }
900  else
901  {
902  /*
903  If an entering variable has been found, a regular basis update is to
904  be performed.
905  */
906  if(enterId != baseId(leaveIdx))
907  {
908  const SVector& newVector = *enterVector(enterId);
909 
910  // update feasibility vectors
911  if(solveVector2 != NULL && solveVector3 != NULL)
912  {
913  assert(solveVector2->isConsistent());
914  assert(solveVector2rhs->isSetup());
915  assert(solveVector3->isConsistent());
916  assert(solveVector3rhs->isSetup());
917  assert(boundflips > 0);
919  *solveVector2,
920  *solveVector3,
921  newVector,
923  *solveVector3rhs);
924 
925  // perform update of basic solution
926  primVec -= (*solveVector3);
927  MSG_DEBUG(std::cout << "ILBFRT02 breakpoints passed / bounds flipped = " << boundflips << std::endl;
928  )
930  }
931  else if(solveVector2 != NULL)
932  {
933  assert(solveVector2->isConsistent());
934  assert(solveVector2rhs->isSetup());
935 
937  *solveVector2,
938  newVector,
939  *solveVector2rhs);
940  }
941  else if(solveVector3 != NULL)
942  {
943  assert(solveVector3->isConsistent());
944  assert(solveVector3rhs->isSetup());
945  assert(boundflips > 0);
947  *solveVector3,
948  newVector,
949  *solveVector3rhs);
950 
951  // perform update of basic solution
952  primVec -= (*solveVector3);
953  MSG_DEBUG(std::cout << "ILBFRT02 breakpoints passed / bounds flipped = " << boundflips << std::endl;
954  )
956  }
957  else
958  SPxBasis::solve4update(theFvec->delta(), newVector);
959 
960 #ifdef ENABLE_ADDITIONAL_CHECKS
961  {
962  SSVector tmp(dim(), epsilon());
963  SPxBasis::solve(tmp, newVector);
964  tmp -= fVec().delta();
965 
966  if(tmp.length() > entertol())
967  {
968  // This happens very frequently and does usually not hurt, so print
969  // these warnings only with verbose level INFO2 and higher.
970  MSG_INFO2((*spxout), (*spxout) << "WLEAVE62\t(" << tmp.length() << ")\n";)
971  }
972  }
973 #endif // ENABLE_ADDITIONAL_CHECKS
974 
975 
976  if(spxAbs(theFvec->delta()[leaveIdx]) < reject_leave_tol)
977  {
978  if(instable)
979  {
980  /* We are in the case that for all leaving variables only instable entering
981  variables were found: Thus, above we already accepted such an instable
982  entering variable. Now even this seems to be impossible, thus we conclude
983  unboundedness/infeasibility. */
984  MSG_INFO3((*spxout), (*spxout) << "ILEAVE03 unboundedness/infeasibility found "
985  << "in leave()" << std::endl;)
986 
987  rejectLeave(leaveNum, leaveId, leaveStat);
988  change(-1, none, 0);
989  objChange = 0.0; // the nonbasicValue is not supposed to be updated in this case
990 
991  /**@todo if shift() is not zero we must not conclude unboundedness */
992  if(rep() == ROW)
993  {
994  computePrimalray4Row(enterVal);
996  }
997  else
998  {
999  computeDualfarkas4Col(enterVal);
1001  }
1002 
1003  return false;
1004  }
1005  else
1006  {
1007  theFvec->delta().clear();
1008  rejectLeave(leaveNum, leaveId, leaveStat, &newVector);
1009  change(-1, none, 0);
1010  objChange = 0.0; // the nonbasicValue is not supposed to be updated in this case
1011 
1012  MSG_DEBUG(std::cout << "DLEAVE63 rejecting leave B (leaveIdx=" << leaveIdx
1013  << ", theCoTest=" << theCoTest[leaveIdx]
1014  << ")" << std::endl;)
1015 
1016  // Note: These changes do not survive a refactorization
1017  theCoTest[leaveIdx] *= 0.01;
1018 
1019  return true;
1020  }
1021  }
1022 
1023  // process leaving variable
1024  if(leavebound > epsilon() || leavebound < -epsilon())
1025  theFrhs->multAdd(-leavebound, baseVec(leaveIdx));
1026 
1027  // process entering variable
1028  Real enterBound;
1029  Real newUBbound;
1030  Real newLBbound;
1031  Real newCoPrhs;
1032 
1033  try
1034  {
1035  getLeaveVals2(leaveMax, enterId, enterBound, newUBbound, newLBbound, newCoPrhs, objChange);
1036  }
1037  catch(const SPxException& F)
1038  {
1039  rejectLeave(leaveNum, leaveId, leaveStat);
1040  change(-1, none, 0);
1041  objChange = 0.0; // the nonbasicValue is not supposed to be updated in this case
1042  throw F;
1043  }
1044 
1045  theUBbound[leaveIdx] = newUBbound;
1046  theLBbound[leaveIdx] = newLBbound;
1047  (*theCoPrhs)[leaveIdx] = newCoPrhs;
1048 
1049  if(enterBound > epsilon() || enterBound < -epsilon())
1050  theFrhs->multAdd(enterBound, newVector);
1051 
1052  // update pricing vectors
1053  theCoPvec->value() = enterVal;
1054  thePvec->value() = enterVal;
1055 
1056  if(enterVal > epsilon() || enterVal < -epsilon())
1057  doPupdate();
1058 
1059  // update feasibility vector
1060  theFvec->value() = -((*theFvec)[leaveIdx] - leavebound)
1061  / theFvec->delta()[leaveIdx];
1062  theFvec->update();
1063  (*theFvec)[leaveIdx] = enterBound - theFvec->value();
1064  updateFtest();
1065 
1066  // update objective funtion value
1067  updateNonbasicValue(objChange);
1068 
1069  // change basis matrix
1070  change(leaveIdx, enterId, &newVector, &(theFvec->delta()));
1071  }
1072 
1073  /*
1074  No entering vector has been selected from the basis. However, if the
1075  shift amount for |coPvec| is bounded, we are in the case, that the
1076  entering variable is moved from one bound to its other, before any of
1077  the basis feasibility variables reaches their bound. This may only
1078  happen in primal/columnwise case with upper and lower bounds on
1079  variables.
1080  */
1081  else
1082  {
1083  // @todo update obj function value here!!!
1084  assert(rep() == ROW);
1085  SPxBasis::Desc& ds = desc();
1086 
1087  change(leaveIdx, none, 0);
1088 
1089  if(leaveStat == SPxBasis::Desc::P_ON_UPPER)
1090  {
1091  if(leaveId.isSPxRowId())
1092  {
1093  ds.rowStatus(leaveNum) = SPxBasis::Desc::P_ON_LOWER;
1094  (*theCoPrhs)[leaveIdx] = theLRbound[leaveNum];
1095  }
1096  else
1097  {
1098  ds.colStatus(leaveNum) = SPxBasis::Desc::P_ON_LOWER;
1099  (*theCoPrhs)[leaveIdx] = theLCbound[leaveNum];
1100  }
1101 
1102  theUBbound[leaveIdx] = 0;
1103  theLBbound[leaveIdx] = -infinity;
1104  }
1105  else
1106  {
1107  assert(leaveStat == SPxBasis::Desc::P_ON_LOWER);
1108 
1109  if(leaveId.isSPxRowId())
1110  {
1111  ds.rowStatus(leaveNum) = SPxBasis::Desc::P_ON_UPPER;
1112  (*theCoPrhs)[leaveIdx] = theURbound[leaveNum];
1113  }
1114  else
1115  {
1116  ds.colStatus(leaveNum) = SPxBasis::Desc::P_ON_UPPER;
1117  (*theCoPrhs)[leaveIdx] = theUCbound[leaveNum];
1118  }
1119 
1120  theUBbound[leaveIdx] = infinity;
1121  theLBbound[leaveIdx] = 0;
1122  }
1123 
1124  // update copricing vector
1125  theCoPvec->value() = enterVal;
1126  thePvec->value() = enterVal;
1127 
1128  if(enterVal > epsilon() || enterVal < -epsilon())
1129  doPupdate();
1130 
1131  // update feasibility vectors
1132  theFvec->value() = 0;
1133  assert(theCoTest[leaveIdx] < 0.0);
1134  m_pricingViol += theCoTest[leaveIdx];
1135  theCoTest[leaveIdx] *= -1;
1136  }
1137 
1138  if((leaveMax > entertol() && enterVal <= entertol()) || (leaveMax < -entertol()
1139  && enterVal >= -entertol()))
1140  {
1141  if((theUBbound[leaveIdx] < infinity || theLBbound[leaveIdx] > -infinity)
1142  && leaveStat != SPxBasis::Desc::P_FREE
1143  && leaveStat != SPxBasis::Desc::D_FREE)
1144  {
1145  m_numCycle++;
1146  leaveCycles++;
1147  }
1148  }
1149  else
1150  m_numCycle /= 2;
1151 
1152 #ifdef ENABLE_ADDITIONAL_CHECKS
1153  {
1154  DVector tmp = fVec();
1155  multBaseWith(tmp);
1156  tmp -= fRhs();
1157 
1158  if(tmp.length() > entertol())
1159  {
1160  // This happens very frequently and does usually not hurt, so print
1161  // these warnings only with verbose level INFO2 and higher.
1162  MSG_INFO2((*spxout), (*spxout) << "WLEAVE64\t" << basis().iteration()
1163  << ": fVec error = " << tmp.length() << std::endl;)
1164  SPxBasis::solve(tmp, fRhs());
1165  tmp -= fVec();
1166  MSG_INFO2((*spxout), (*spxout) << "WLEAVE65\t(" << tmp.length() << ")\n";)
1167  }
1168  }
1169 #endif // ENABLE_ADDITIONAL_CHECKS
1170 
1171  return true;
1172  }
1173 }
1174 } // namespace soplex
const VectorBase< R > & rhs() const
Returns right hand side vector.
Definition: spxlpbase.h:221
void computeFtest()
compute basis feasibility test vector.
Definition: leave.cpp:39
Rational spxAbs(const Rational &r)
Absolute.
Definition: rational.cpp:4102
int iteration() const
returns number of basis changes since last load().
Definition: spxbasis.h:546
Exception class for things that should NEVER happen.This class is derived from the SoPlex exception b...
Definition: exceptions.h:109
bool isSetup() const
Returns setup status.
Definition: ssvectorbase.h:121
virtual void rejectLeave(int leaveNum, SPxId leaveId, SPxBasis::Desc::Status leaveStat, const SVector *newVec=0)
Definition: leave.cpp:650
void coSolve(Vector &x, const Vector &rhs)
Cosolves linear system with basis matrix.
Definition: spxbasis.h:730
primal variable is fixed to both bounds
Definition: spxbasis.h:190
UpdateVector primVec
primal vector
Definition: spxsolver.h:341
int boundflips
number of performed bound flips
Definition: spxsolver.h:392
const VectorBase< Real > & upper() const
Returns upper bound vector.
Definition: spxlpbase.h:461
const Vector & fTest() const
Violations of fVec.
Definition: spxsolver.h:1385
Desc::Status dualColStatus(int i) const
dual Status for the i&#39;th column variable of the loaded LP.
Definition: spxbasis.cpp:69
DIdxSet updateViols
store indices that were changed in the previous iteration and must be checked in hyper pricing ...
Definition: spxsolver.h:435
SPxOut * spxout
message handler
Definition: spxsolver.h:463
bool sparsePricingLeave
These values enable or disable sparse pricing.
Definition: spxsolver.h:448
THREADLOCAL const Real infinity
Definition: spxdefines.cpp:26
bool leave(int i, bool polish=false)
Definition: leave.cpp:716
DVector theCoTest
Definition: spxsolver.h:381
Abstract pricer base class.
Real leavetol() const
feasibility tolerance maintained by ratio test during LEAVE algorithm.
Definition: spxsolver.h:796
SSVector * solveVector3
when 3 systems are to be solved at a time; typically reserved for bound flipping ratio test (basic so...
Definition: spxsolver.h:279
void updateFtest()
update basis feasibility test vector.
Definition: leave.cpp:107
void computePrimalray4Row(Real direction)
Definition: leave.cpp:694
Exception classes for SoPlex.
Status & rowStatus(int i)
Definition: spxbasis.h:239
Abstract ratio test base class.
virtual void perturbMaxLeave(void)
perturb nonbasic bounds.
Definition: spxshift.cpp:498
int m_maxCycle
maximum steps before cycling is detected.
Definition: spxsolver.h:270
DataArray< int > isInfeasible
0: index not violated, 1: index violated, 2: index violated and among candidate list ...
Definition: spxsolver.h:443
bool NE(Real a, Real b, Real eps=Param::epsilon())
returns true iff |a-b| > eps
Definition: spxdefines.h:382
Real length() const
Floating point approximation of euclidian norm (without any approximation guarantee).
Definition: vectorbase.h:399
int number(const SPxRowId &id) const
Returns the row number of the row with identifier id.
Definition: spxlpbase.h:527
void clear()
removes all indices.
Definition: idxset.h:184
int lastUpdate() const
returns number of basis changes since last refactorization.
Definition: spxbasis.h:540
int dim() const
dimension of basis matrix.
Definition: spxsolver.h:1075
Vector & multBaseWith(Vector &x) const
Basis-vector product.
Definition: spxbasis.cpp:1023
virtual SPxId selectEnter(Real &val, int leaveIdx, bool polish=false)=0
selects variable Id to enter the basis.
Real sparsePricingFactor
enable sparse pricing when viols < factor * dim()
Definition: spxsolver.h:314
SSVector * solveVector2rhs
when 2 systems are to be solved at a time; typically for speepest edge weights
Definition: spxsolver.h:277
Ids for LP columns.Class SPxColId provides DataKeys for the column indices of an SPxLP.
Definition: spxid.h:36
int sign(const Rational &r)
Sign function; returns 1 if r > 0, 0 if r = 0, and -1 if r < 0.
Definition: rational.cpp:4115
virtual void doPupdate(void)
Definition: spxvecs.cpp:554
virtual Real value()
current objective value.
Definition: spxsolver.cpp:939
rowwise representation.
Definition: spxsolver.h:107
Basis is singular.
Definition: spxbasis.h:93
Desc::Status dualRowStatus(int i) const
dual Status for the i&#39;th row variable of the loaded LP.
Definition: spxbasis.cpp:46
virtual const std::string what() const
returns exception message
Definition: exceptions.h:57
dual variable is left free, but unset
Definition: spxbasis.h:191
Wrapper for different output streams and verbosity levels.
void add(const SVectorBase< S > &vec)
Append nonzeros of sv.
Definition: dsvectorbase.h:218
const Vector & fRhs() const
right-hand side vector for fVec
Definition: spxsolver.h:1336
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
UpdateVector & coPvec() const
copricing vector.
Definition: spxsolver.h:1398
int remainingRoundsLeave
number of dense rounds/refactorizations until sparsePricing is enabled again
Definition: spxsolver.h:454
int m_numCycle
actual number of degenerate steps so far.
Definition: spxsolver.h:271
Leaving Simplex.
Definition: spxsolver.h:143
SPxStatus status() const
returns current SPxStatus.
Definition: spxbasis.h:425
SSVector * solveVector3rhs
when 3 systems are to be solved at a time; typically reserved for bound flipping ratio test (basic so...
Definition: spxsolver.h:281
const SVector & baseVec(int i) const
returns the i&#39;th basic vector.
Definition: spxbasis.h:515
bool m_pricingViolCoUpToDate
true, if the stored violation in coDim is up to date
Definition: spxsolver.h:264
double Real
Definition: spxdefines.h:218
DVector * theFrhs
Definition: spxsolver.h:360
#define MSG_DEBUG(x)
Definition: spxdefines.h:132
virtual const SVector * enterVector(const SPxId &p_id)
Get pointer to the id &#39;th vector.
Definition: spxsolver.h:1896
Real m_pricingViol
maximal feasibility violation of current solution
Definition: spxsolver.h:260
Real entertol() const
feasibility tolerance maintained by ratio test during ENTER algorithm.
Definition: spxsolver.h:789
UpdateVector * thePvec
Definition: spxsolver.h:368
void update()
Perform the update.
Definition: updatevector.h:147
int size() const
returns the number of used indices.
Definition: idxset.h:124
#define MSG_INFO2(spxout, x)
Prints out message x if the verbosity level is at least SPxOut::INFO2.
Definition: spxdefines.h:120
#define MSG_ERROR(x)
Prints out message x if the verbosity level is at least SPxOut::ERROR.
Definition: spxdefines.h:114
int size() const
Returns number of elements.
Definition: classarray.h:208
UpdateVector & fVec() const
feasibility vector.
Definition: spxsolver.h:1323
bool isSPxColId() const
is id a column id?
Definition: spxid.h:166
dual variable is set to its upper bound
Definition: spxbasis.h:192
DVector theLBbound
Lower Basic Feasibility bound.
Definition: spxsolver.h:357
main LP solver class
virtual void setupPupdate(void)
Definition: spxvecs.cpp:534
void addIdx(int i)
adds index i to the index set
Definition: didxset.h:79
bool isBasic(SPxBasis::Desc::Status stat) const
does stat describe a basic index ?
Definition: spxsolver.h:1263
Real delta() const
guaranteed primal and dual bound violation for optimal solution, returning the maximum of feastol() a...
Definition: spxsolver.h:819
primal variable is left free, but unset
Definition: spxbasis.h:189
const VectorBase< R > & lhs() const
Returns left hand side vector.
Definition: spxlpbase.h:255
void clear()
Clears vector.
Definition: ssvectorbase.h:603
bool updateNonbasicValue(Real objChange)
Definition: spxsolver.cpp:962
Basis descriptor.
Definition: spxbasis.h:104
DVector theURbound
Upper Row Feasibility bound.
Definition: spxsolver.h:346
bool isConsistent() const
consistency check.
Definition: ssvectorbase.h:620
int leaveCycles
the number of degenerate steps during the leaving algorithm
Definition: spxsolver.h:396
int index(int n) const
Returns index of the n &#39;th nonzero element.
Definition: ssvectorbase.h:175
virtual void getLeaveVals(int i, SPxBasis::Desc::Status &leaveStat, SPxId &leaveId, Real &leaveMax, Real &leavebound, int &leaveNum, StableSum< Real > &objChange)
Definition: leave.cpp:196
Status & colStatus(int i)
Definition: spxbasis.h:254
SPxId & baseId(int i)
Definition: spxbasis.h:504
DVector theUBbound
Upper Basic Feasibility bound.
Definition: spxsolver.h:356
#define MSG_INFO3(spxout, x)
Prints out message x if the verbosity level is at least SPxOut::INFO3.
Definition: spxdefines.h:122
virtual void change(int i, SPxId &id, const SVector *enterVec, const SSVector *eta=0)
performs basis update.
Definition: spxbasis.cpp:773
Real m_pricingViolCo
maximal feasibility violation of current solution in coDim
Definition: spxsolver.h:263
Real epsilon() const
values are considered to be 0.
Definition: spxsolver.h:784
void computeDualfarkas4Col(Real direction)
Definition: leave.cpp:705
Debugging, floating point type and parameter definitions.
int totalboundflips
total number of bound flips
Definition: spxsolver.h:393
SSVector * solveVector2
when 2 systems are to be solved at a time; typically for speepest edge weights
Definition: spxsolver.h:275
DIdxSet infeasibilities
Definition: spxsolver.h:429
DVector theLRbound
Lower Row Feasibility bound.
Definition: spxsolver.h:347
DVector theUCbound
Upper Column Feasibility bound.
Definition: spxsolver.h:348
static const Real reject_leave_tol
Definition: leave.cpp:31
VectorBase< R > & multAdd(const S &x, const VectorBase< T > &vec)
Addition of scaled vector.
Definition: vectorbase.h:412
Exception base class.This class implements a base class for our SoPlex exceptions We provide a what()...
Definition: exceptions.h:32
int size() const
Returns the number of nonzeros.
Definition: ssvectorbase.h:200
Everything should be within this namespace.
const IdxSet & idx() const
nonzero indices of update vector
Definition: updatevector.h:133
void clear()
Remove all indices.
Definition: svectorbase.h:431
UpdateVector * theFvec
Definition: spxsolver.h:362
void solve4update(SSVector &x, const SVector &rhs)
solves linear system with basis matrix.
Definition: spxbasis.h:669
primal variable is set to its lower bound
Definition: spxbasis.h:187
const VectorBase< R > & maxObj() const
Returns objective vector for maximization problem.
Definition: spxlpbase.h:434
virtual void getLeaveVals2(Real leaveMax, SPxId enterId, Real &enterBound, Real &newUBbound, Real &newLBbound, Real &newCoPrhs, StableSum< Real > &objChange)
Definition: leave.cpp:402
std::streamsize precision() const
Definition: spxout.h:139
DVector theLCbound
Lower Column Feasibility bound.
Definition: spxsolver.h:349
Real & value()
update multiplicator , writeable
Definition: updatevector.h:111
void computeFrhs()
compute feasibility vector from scratch.
Definition: spxvecs.cpp:42
virtual void perturbMinLeave(void)
Definition: spxshift.cpp:485
bool isSPxRowId() const
is id a row id?
Definition: spxid.h:161
SPxRatioTester * theratiotester
Definition: spxsolver.h:403
bool isValid() const
returns TRUE iff the id is a valid column or row identifier.
Definition: spxid.h:151
#define DENSEROUNDS
Definition: spxsolver.h:41
dual variable is set to its lower bound
Definition: spxbasis.h:193
DSVector primalRay
stores primal ray in case of unboundedness
Definition: spxsolver.h:384
Type type() const
return current Type.
Definition: spxsolver.h:512
Real theShift
sum of all shifts applied to any bound.
Definition: spxsolver.h:268
Real length() const
Floating point approximation of euclidian norm (without any approximation guarantee).
Definition: ssvectorbase.h:551
bool isConsistent() const
DSVector dualFarkas
stores dual farkas proof in case of infeasibility
Definition: spxsolver.h:385
Array< UnitVector > unitVecs
array of unit vectors
Definition: spxsolver.h:336
dual variable has two bounds
Definition: spxbasis.h:194
bool recomputedVectors
flag to perform clean up step to reduce numerical errors only once
Definition: spxsolver.h:310
Exception class for status exceptions during the computationsThis class is derived from the SoPlex ex...
Definition: exceptions.h:89
Ids for LP rows.Class SPxRowId provides DataKeys for the row indices of an SPxLP. ...
Definition: spxid.h:55
bool initialized
true, if all vectors are setup.
Definition: spxsolver.h:272
void forceRecompNonbasicValue()
Definition: spxsolver.h:670
void solve(Vector &x, const Vector &rhs)
Definition: spxbasis.h:632
SSVector & delta()
update vector , writeable
Definition: updatevector.h:122
bool m_pricingViolUpToDate
true, if the stored violation is up to date
Definition: spxsolver.h:261
int index(int n) const
access n &#39;th index.
Definition: idxset.h:118
UpdateVector * theCoPvec
Definition: spxsolver.h:366
const SPxBasis & basis() const
Return current basis.
Definition: spxsolver.h:1761
Status
Status of a variable.
Definition: spxbasis.h:185
LP has been proven to be primal unbounded.
Definition: spxbasis.h:98
bool hyperPricingLeave
true if hyper sparse pricing is turned on in the leaving Simplex
Definition: spxsolver.h:451
const VectorBase< Real > & lower() const
Returns (internal and possibly scaled) lower bound vector.
Definition: spxlpbase.h:488
const Desc & desc() const
Definition: spxbasis.h:464
Representation rep() const
return the current basis representation.
Definition: spxsolver.h:506
Set of indices.Class IdxSet provides a set of indices. At construction it must be given an array of i...
Definition: idxset.h:56
columnwise representation.
Definition: spxsolver.h:108
R value(int n) const
Returns value of the n &#39;th nonzero element.
Definition: ssvectorbase.h:183
virtual void factorize()
Factorize basis matrix.
Definition: spxsolver.cpp:557
void setBasisStatus(SPxBasis::SPxStatus stat)
set the lp solver&#39;s basis status.
Definition: spxsolver.h:2051
void setMax(int newmax=1)
Reset nonzero memory to >= newmax.
Definition: dsvectorbase.h:250
LP has been proven to be primal infeasible.
Definition: spxbasis.h:99