Scippy

SoPlex

Sequential object-oriented simPlex

spxsolver.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 #include <assert.h>
17 #include <iostream>
18 #include <sstream>
19 
20 #include "spxdefines.h"
21 #include "soplex.h"
22 #include "spxpricer.h"
23 #include "spxratiotester.h"
24 #include "spxstarter.h"
25 #include "spxout.h"
26 #include "timerfactory.h"
27 
28 namespace soplex
29 {
30 
31 bool SPxSolver::read(std::istream& in, NameSet* rowNames,
32  NameSet* colNames, DIdxSet* intVars)
33 {
34  if( initialized )
35  {
36  clear();
37  unInit();
38 
39  if (thepricer)
40  thepricer->clear();
41 
42  if (theratiotester)
44  }
45 
46  unLoad();
47  if (!SPxLP::read(in, rowNames, colNames, intVars))
48  return false;
49 
50  theLP = this;
51 
52  return true;
53 }
54 
56 {
58  unInit();
59  unLoad();
60  theLP = this;
62  if (thepricer)
63  thepricer->clear();
64  if (theratiotester)
66 }
67 
68 void SPxSolver::loadLP(const SPxLP& lp)
69 {
70  clear();
71  unInit();
72  unLoad();
74  if (thepricer)
75  thepricer->clear();
76  if (theratiotester)
78  SPxLP::operator=(lp);
79  reDim();
80  SPxBasis::load(this);
81 }
82 
83 void SPxSolver::setSolver(SLinSolver* slu, const bool destroy)
84 {
85  // we need to set the outstream before we load the solver to ensure that the basis
86  // can be initialized with this pointer in loadSolver()
87  assert(spxout != 0);
88  slu->spxout = spxout;
89  SPxBasis::loadSolver(slu, destroy);
90 }
91 
93 {
94  unInit();
96  SPxBasis::load(this);
97  SPxBasis::loadDesc(p_desc);
99 }
100 
101 void SPxSolver::setPricer(SPxPricer* x, const bool destroy)
102 {
103 
104  assert(!freePricer || thepricer != 0);
105 
106  if(freePricer)
107  {
108  delete thepricer;
109  thepricer = 0;
110  }
111 
112  if (x != 0 && x != thepricer)
113  {
114  setPricing(FULL);
115  if (isInitialized())
116  x->load(this);
117  else
118  x->clear();
119  }
120 
121  if (thepricer && thepricer != x)
122  thepricer->clear();
123  thepricer = x;
124 
125  freePricer = destroy;
126 }
127 
128 void SPxSolver::setTester(SPxRatioTester* x, const bool destroy)
129 {
130 
131  assert(!freeRatioTester || theratiotester != 0);
132 
133  if(freeRatioTester)
134  {
135  delete theratiotester;
136  theratiotester = 0;
137  }
138 
139  if (x)
140  {
141  if (isInitialized() && x != theratiotester)
142  x->load(this);
143  else
144  x->clear();
145  }
146 
147  if (theratiotester !=0 && theratiotester != x)
149  theratiotester = x;
150 
151  freeRatioTester = destroy;
152 }
153 
154 void SPxSolver::setStarter(SPxStarter* x, const bool destroy)
155 {
156 
157  assert(!freeStarter || thestarter != 0);
158 
159  if(freeStarter)
160  {
161  delete thestarter;
162  thestarter = 0;
163  }
164  thestarter = x;
165 
166  freeStarter = destroy;
167 }
168 
170 {
171 
172  if (theType != tp)
173  {
174  theType = tp;
175 
177 
178  unInit();
179 #if 0
180  else
181  {
182  if (!matrixIsSetup)
183  {
184  SPxBasis::load(this);
185  // SPxBasis::load(desc());
186  // not needed, because load(this) allready loads descriptor
187  }
188  factorized = false;
189  m_numCycle = 0;
190 #endif
191  MSG_INFO3( (*spxout), (*spxout) << "Switching to "
192  << static_cast<const char*>((tp == LEAVE)
193  ? "leaving" : "entering")
194  << " algorithm" << std::endl; )
195  }
196 }
197 
199 {
200 
201  Real tmpfeastol = feastol();
202  Real tmpopttol = opttol();
203 
204  theRep = p_rep;
205 
206  if (theRep == COLUMN)
207  {
208  thevectors = colSet();
209  thecovectors = rowSet();
210  theFrhs = &primRhs;
211  theFvec = &primVec;
212  theCoPrhs = &dualRhs;
213  theCoPvec = &dualVec;
214  thePvec = &addVec;
216  theCPvec = thePvec;
221  }
222  else
223  {
224  assert(theRep == ROW);
225 
226  thevectors = rowSet();
227  thecovectors = colSet();
228  theFrhs = &dualRhs;
229  theFvec = &dualVec;
230  theCoPrhs = &primRhs;
231  theCoPvec = &primVec;
232  thePvec = &addVec;
233  theRPvec = thePvec;
239  }
240  unInit();
241  reDim();
242 
244 
245  setFeastol(tmpfeastol);
246  setOpttol(tmpopttol);
247 
251 
252  if (thepricer && thepricer->solver() == this)
253  thepricer->setRep(p_rep);
254 }
255 
257 {
258 
259  if (p_rep != theRep)
260  initRep(p_rep);
261 }
262 
263 // needed for strongbranching. use carefully
265 {
266 
267  initialized = true;
268 
269  if (type() == ENTER)
270  {
271  if (rep() == COLUMN)
272  setPrimalBounds();
273  else
275 
276  setEnterBounds();
278  }
279  else
280  {
281  if (rep() == ROW)
282  setPrimalBounds();
283  else
285 
286  setLeaveBounds();
288  }
289 
291  computePvec();
292  computeFrhs();
294 
295  theShift = 0.0;
296  lastShift = 0.0;
297 
298  if (type() == ENTER)
299  {
300  computeCoTest();
301  computeTest();
302  }
303  else
304  {
305  computeFtest();
306  }
307  assert((testBounds(), 1));
308 }
309 
311 {
312  nClckSkipsLeft = 0;
313  nCallsToTimelim = 0;
314  theCumulativeTime = 0.0;
315 }
316 
318 {
319 
320  assert(thepricer != 0);
321  assert(theratiotester != 0);
322 
323  if (!initialized)
324  {
325  initialized = true;
326  reDim();
327  if (SPxBasis::status() <= SPxBasis::NO_PROBLEM || solver() != this)
328  SPxBasis::load(this);
329  initialized = false;
330  }
331  if (!matrixIsSetup)
333 
334  // Inna/Tobi: don't "upgrade" a singular basis to a regular one
336  return;
337 
338  //factorized = false;
339  m_numCycle = 0;
340 
341  if (type() == ENTER)
342  {
343  if (rep() == COLUMN)
344  {
345  setPrimalBounds();
347  }
348  else
349  {
352  }
353  setEnterBounds();
355  // prepare support vectors for sparse pricing
361  }
362  else
363  {
364  if (rep() == ROW)
365  {
366  setPrimalBounds();
368  }
369  else
370  {
373  }
374  setLeaveBounds();
376  // prepare support vectors for sparse pricing
380  }
381 
382  // we better factorize explicitly before solving
383  if( !factorized )
384  {
385  try
386  {
388  }
389  catch( const SPxException& x )
390  {
391  // we need to abort in case the factorization failed
393  m_status = SINGULAR;
394  throw SPxStatusException("XINIT01 Singular basis in initialization detected.");
395  }
396  }
397 
399  computePvec();
400  computeFrhs();
402 
403  theShift = 0.0;
404 
405  if (type() == ENTER)
406  {
407  shiftFvec();
409 
410  computeCoTest();
411  computeTest();
412  }
413  else
414  {
415  shiftPvec();
417 
418  computeFtest();
419  }
420 
421  if (!initialized)
422  {
423  // if(thepricer->solver() != this)
424  thepricer->load(this);
425  // if(theratiotester->solver() != this)
426  theratiotester->load(this);
427  initialized = true;
428  }
429 }
430 
432 {
433  thePricing = pr;
434  if (initialized && type() == ENTER)
435  {
436  computePvec();
437  computeCoTest();
438  computeTest();
439  }
440 }
441 
442 /*
443  The following method resizes all vectors and arrays of |SoPlex|
444  (excluding inherited vectors).
445  */
447 {
448 
449  int newsize = SPxLP::nCols() > SPxLP::nRows() ? SPxLP::nCols() : SPxLP::nRows();
450 
451  if (newsize > unitVecs.size())
452  {
453  unitVecs.reSize(newsize);
454 
455  while (newsize-- > 0)
456  unitVecs[newsize] = UnitVector(newsize);
457  }
458 
459  if (isInitialized())
460  {
461  theFrhs->reDim(dim());
462  theFvec->reDim(dim());
463  thePvec->reDim(coDim());
464 
465  theCoPrhs->reDim(dim());
466  theCoPvec->reDim(dim());
467 
468  theTest.reDim(coDim());
469  theCoTest.reDim(dim());
470 
475  theUBbound.reDim(dim());
476  theLBbound.reDim(dim());
477  }
478 }
479 
481 {
482  unitVecs.reSize(0);
483 
484  dualRhs.clear();
485  dualVec.clear();
486  primRhs.clear();
487  primVec.clear();
488  addVec.clear();
489  theURbound.clear();
490  theLRbound.clear();
491  theUCbound.clear();
492  theLCbound.clear();
493  theTest.clear();
494  theCoTest.clear();
495 
497  unInit();
498  SPxLP::clear();
500  // clear the basis only when theLP is present, because LP data (nrows, ncols) is used in reDim()
501  if( theLP != 0 )
502  SPxBasis::reDim();
503 
508 }
509 
511 {
512  theFvec->clearUpdate();
513  thePvec->clearUpdate();
515  solveVector2 = 0;
516  solveVector3 = 0;
517  coSolveVector2 = 0;
518  coSolveVector3 = 0;
519 }
520 
521 /*
522  When the basis matrix factorization is recomputed from scratch,
523  we also recompute the vectors.
524  */
526 {
527 
528  MSG_INFO3( (*spxout), (*spxout) << " --- refactorizing basis matrix" << std::endl; )
529 
530  try
531  {
533  }
534  catch( const SPxStatusException& E )
535  {
537  m_status = SINGULAR;
538  std::stringstream s;
539  s << "Basis is singular (numerical troubles, feastol = " << feastol() << ", opttol = " << opttol() << ")";
540  throw SPxStatusException(s.str());
541  }
542 
543  if( !initialized )
544  {
545  init(); // not sure if init() is neccessary here
546  // we must not go on here because not all vectors (e.g. fVec) may be set up correctly
547  return;
548  }
549 
551  {
552 #ifndef NDEBUG
553  DVector ftmp(fVec());
554  DVector ptmp(pVec());
555  DVector ctmp(coPvec());
556 #endif // NDEBUG
557 
558  if (type() == LEAVE)
559  {
560  /* we have to recompute theFrhs, because roundoff errors can occur during updating, especially when
561  * columns/rows with large bounds are present
562  */
563  computeFrhs();
566 
567 #ifndef NDEBUG
568  ftmp -= fVec();
569  ptmp -= pVec();
570  ctmp -= coPvec();
571  if (ftmp.length() > DEFAULT_BND_VIOL)
572  {
573  MSG_DEBUG( std::cout << "DSOLVE21 fVec: " << ftmp.length() << std::endl; )
574  ftmp = fVec();
575  multBaseWith(ftmp);
576  ftmp -= fRhs();
577  if (ftmp.length() > DEFAULT_BND_VIOL)
578  MSG_ERROR( std::cerr << "ESOLVE29 " << iteration() << ": fVec error = "
579  << ftmp.length() << " exceeding DEFAULT_BND_VIOL = " << DEFAULT_BND_VIOL << std::endl; )
580  }
581  if (ctmp.length() > DEFAULT_BND_VIOL)
582  {
583  MSG_DEBUG( std::cout << "DSOLVE23 coPvec: " << ctmp.length() << std::endl; )
584  ctmp = coPvec();
585  multWithBase(ctmp);
586  ctmp -= coPrhs();
587  if (ctmp.length() > DEFAULT_BND_VIOL)
588  MSG_ERROR( std::cerr << "ESOLVE30 " << iteration() << ": coPvec error = "
589  << ctmp.length() << " exceeding DEFAULT_BND_VIOL = " << DEFAULT_BND_VIOL << std::endl; )
590  }
591  if (ptmp.length() > DEFAULT_BND_VIOL)
592  {
593  MSG_DEBUG( std::cout << "DSOLVE24 pVec: " << ptmp.length() << std::endl; )
594  }
595 #endif // NDEBUG
596 
597  computeFtest();
598  }
599  else
600  {
601  assert(type() == ENTER);
602 
604  computeCoTest();
605 
606  if (pricing() == FULL)
607  {
608  /* to save time only recompute the row activities (in row rep) when we are already nearly optimal to
609  * avoid missing any violations from previous updates */
610  if( rep() == ROW && m_pricingViolCo < entertol() && m_pricingViol < entertol() )
611  computePvec();
612 
613  /* was deactivated, but this leads to warnings in testVecs() */
614  computeTest();
615  }
616  }
617  }
618 
619 #ifdef ENABLE_ADDITIONAL_CHECKS
620  /* moved this test after the computation of fTest and coTest below, since these vectors might not be set up at top, e.g. for an initial basis */
622  testVecs();
623 #endif
624 }
625 
626 /* We compute how much the current solution violates (primal or dual) feasibility. In the
627  row/enter or column/leave algorithm the maximum violation of dual feasibility is
628  computed. In the row/leave or column/enter algorithm the primal feasibility is checked.
629  Additionally, the violation from pricing is taken into account. */
631 {
632  Real inf = 0.0;
633 
634  if (type() == ENTER)
635  {
638 
639  for (int i = 0; i < dim(); i++)
640  {
641  if ((*theFvec)[i] > theUBbound[i])
642  inf = MAXIMUM(inf, (*theFvec)[i] - theUBbound[i]);
643  else if ((*theFvec)[i] < theLBbound[i])
644  inf = MAXIMUM(inf, theLBbound[i] - (*theFvec)[i]);
645  }
646  }
647  else
648  {
649  assert(type() == LEAVE);
650 
652  inf = m_pricingViol;
653 
654  for (int i = 0; i < dim(); i++)
655  {
656  if ((*theCoPvec)[i] > (*theCoUbound)[i])
657  inf = MAXIMUM(inf, (*theCoPvec)[i] - (*theCoUbound)[i]);
658  else if ((*theCoPvec)[i] < (*theCoLbound)[i])
659  inf = MAXIMUM(inf, (*theCoLbound)[i] - (*theCoPvec)[i]);
660  }
661  for (int i = 0; i < coDim(); i++)
662  {
663  if ((*thePvec)[i] > (*theUbound)[i])
664  inf = MAXIMUM(inf, (*thePvec)[i] - (*theUbound)[i]);
665  else if ((*thePvec)[i] < (*theLbound)[i])
666  inf = MAXIMUM(inf, (*theLbound)[i] - (*thePvec)[i]);
667  }
668  }
669 
670  return inf;
671 }
672 
673 /* check for (dual) violations above tol and immediately return false w/o checking the remaining values
674  This method is useful for verifying whether an objective limit can be used as termination criterion */
675 bool SPxSolver::noViols(Real tol) const
676 {
677  assert(tol >= 0.0);
678 
679  if( type() == ENTER )
680  {
681  for( int i = 0; i < dim(); i++ )
682  {
683  if( (*theFvec)[i] - theUBbound[i] > tol )
684  return false;
685  if( theLBbound[i] - (*theFvec)[i] > tol )
686  return false;
687  }
688  }
689  else
690  {
691  assert(type() == LEAVE);
692 
693  for( int i = 0; i < dim(); i++ )
694  {
695  if( (*theCoPvec)[i] - (*theCoUbound)[i] > tol )
696  return false;
697  if( (*theCoLbound)[i] - (*theCoPvec)[i] > tol )
698  return false;
699  }
700  for (int i = 0; i < coDim(); i++)
701  {
702  if( (*thePvec)[i] - (*theUbound)[i] > tol )
703  return false;
704  if( (*theLbound)[i] - (*thePvec)[i] > tol )
705  return false;
706  }
707  }
708  return true;
709 }
710 
712 {
713  int i;
714  Real val = 0;
715  const SPxBasis::Desc& ds = desc();
716 
717 #ifndef ADDITIONAL_CHECKS
718  // if the value is available we don't need to recompute it
720  return m_nonbasicValue;
721 #endif
722 
723  if (rep() == COLUMN)
724  {
725  if (type() == LEAVE)
726  {
727  for (i = nCols() - 1; i >= 0; --i)
728  {
729  switch (ds.colStatus(i))
730  {
732  val += theUCbound[i] * SPxLP::upper(i);
733  //@ val += maxObj(i) * SPxLP::upper(i);
734  break;
736  val += theLCbound[i] * SPxLP::lower(i);
737  //@ val += maxObj(i) * SPxLP::lower(i);
738  break;
740  val += maxObj(i) * SPxLP::lower(i);
741  break;
742  default:
743  break;
744  }
745  }
746  for (i = nRows() - 1; i >= 0; --i)
747  {
748  switch (ds.rowStatus(i))
749  {
751  val += theLRbound[i] * SPxLP::rhs(i);
752  break;
754  val += theURbound[i] * SPxLP::lhs(i);
755  break;
757  val += maxRowObj(i) * SPxLP::lhs(i);
758  break;
759  default:
760  break;
761  }
762  }
763  }
764  else
765  {
766  assert(type() == ENTER);
767  for (i = nCols() - 1; i >= 0; --i)
768  {
769  switch (ds.colStatus(i))
770  {
772  val += maxObj(i) * theUCbound[i];
773  break;
775  val += maxObj(i) * theLCbound[i];
776  break;
778  assert(theLCbound[i] == theUCbound[i]);
779  val += maxObj(i) * theLCbound[i];
780  break;
781  default:
782  break;
783  }
784  }
785  for (i = nRows() - 1; i >= 0; --i)
786  {
787  switch (ds.rowStatus(i))
788  {
790  val += maxRowObj(i) * theLRbound[i];
791  break;
793  val += maxRowObj(i) * theURbound[i];
794  break;
796  val += maxRowObj(i) * theURbound[i];
797  break;
798  default:
799  break;
800  }
801  }
802  }
803  }
804  else
805  {
806  assert(rep() == ROW);
807  assert(type() == ENTER);
808  for (i = nCols() - 1; i >= 0; --i)
809  {
810  switch (ds.colStatus(i))
811  {
813  val += theUCbound[i] * lower(i);
814  break;
816  val += theLCbound[i] * upper(i);
817  break;
819  val += theLCbound[i] * upper(i);
820  val += theUCbound[i] * lower(i);
821  break;
822  default:
823  break;
824  }
825  }
826  for (i = nRows() - 1; i >= 0; --i)
827  {
828  switch (ds.rowStatus(i))
829  {
831  val += theURbound[i] * lhs(i);
832  break;
834  val += theLRbound[i] * rhs(i);
835  break;
837  val += theLRbound[i] * rhs(i);
838  val += theURbound[i] * lhs(i);
839  break;
840  default:
841  break;
842  }
843  }
844  }
845 
846 #ifdef ADDITIONAL_CHECKS
848  {
849  MSG_ERROR( std::cerr << "stored nonbasic value: " << m_nonbasicValue << ", correct nonbasic value: " << val << std::endl; )
850  assert(EQrel(m_nonbasicValue, val,1e-14));
851  }
852 #endif
853 
855  {
856  m_nonbasicValue = val;
858  }
859 
860  return val;
861 }
862 
864 {
865  assert(isInitialized());
866 
867  Real x;
868 
869  // calling value() without having a suitable status is an error.
870  if (!isInitialized())
871  return infinity;
872 
873  if (rep() == ROW)
874  {
875  if (type() == LEAVE)
876  x = SPxLP::spxSense() * (coPvec() * fRhs()); // the contribution of maxRowObj() is missing
877  else
878  x = SPxLP::spxSense() * (nonbasicValue() + (coPvec() * fRhs()));
879  }
880  else
881  x = SPxLP::spxSense() * (nonbasicValue() + fVec() * coPrhs());
882 
883  return x;
884 }
885 
887 {
889  m_nonbasicValue += objChange;
890 
891  MSG_DEBUG( std::cout
892  << "Iteration: " << iteration()
893  << ": updated objValue: " << objChange
894  << ", new value: " << m_nonbasicValue
895  << ", correct value: " << nonbasicValue()
896  << std::endl;
897  )
898 
900 }
901 
902 
903 
905 {
906 
907  if( d <= 0.0 )
908  throw SPxInterfaceException("XSOLVE30 Cannot set feastol less than or equal to zero.");
909 
910  if( theRep == COLUMN )
911  m_entertol = d;
912  else
913  m_leavetol = d;
914 }
915 
917 {
918 
919  if( d <= 0.0 )
920  throw SPxInterfaceException("XSOLVE31 Cannot set opttol less than or equal to zero.");
921 
922  if( theRep == COLUMN )
923  m_leavetol = d;
924  else
925  m_entertol = d;
926 }
927 
929 {
930 
931  if( d <= 0.0 )
932  throw SPxInterfaceException("XSOLVE32 Cannot set delta less than or equal to zero.");
933 
934  m_entertol = d;
935  m_leavetol = d;
936 }
937 
939 {
940  hyperPricingEnter = h;
941  hyperPricingLeave = h;
942  if( h )
943  {
946  }
947 }
948 
950  Type p_type,
951  Representation p_rep,
952  Timer::TYPE ttype)
953  : theType (p_type)
954  , thePricing(FULL)
955  , theRep(p_rep)
956  , theTime(0)
957  , timerType(ttype)
958  , theCumulativeTime(0.0)
959  , maxIters (-1)
960  , maxTime (infinity)
961  , nClckSkipsLeft(0)
962  , nCallsToTimelim(0)
963  , objLimit(infinity)
964  , m_status(UNKNOWN)
965  , m_nonbasicValue(0.0)
966  , m_nonbasicValueUpToDate(false)
967  , m_pricingViol(0.0)
968  , m_pricingViolUpToDate(false)
969  , m_pricingViolCo(0.0)
970  , m_pricingViolCoUpToDate(false)
971  , theShift (0)
972  , m_maxCycle(100)
973  , m_numCycle(0)
974  , initialized (false)
975  , solveVector2 (0)
976  , solveVector3 (0)
977  , coSolveVector2(0)
978  , coSolveVector3(0)
979  , freePricer (false)
980  , freeRatioTester (false)
981  , freeStarter (false)
982  , displayLine (0)
983  , displayFreq (200)
985  , unitVecs (0)
986  , primVec (0, Param::epsilon())
987  , dualVec (0, Param::epsilon())
988  , addVec (0, Param::epsilon())
989  , thepricer (0)
990  , theratiotester (0)
991  , thestarter (0)
992  , infeasibilities(0)
993  , infeasibilitiesCo(0)
994  , isInfeasible(0)
995  , isInfeasibleCo(0)
996  , sparsePricingLeave(false)
997  , sparsePricingEnter(false)
998  , sparsePricingEnterCo(false)
999  , hyperPricingLeave(true)
1000  , hyperPricingEnter(true)
1004 {
1006 
1008 
1009  theLP = this;
1010  initRep(p_rep);
1011 
1012  // info: SPxBasis is not consistent in this moment.
1013  //assert(SPxSolver::isConsistent());
1014 }
1015 
1017 {
1018  assert(!freePricer || thepricer != 0);
1019  assert(!freeRatioTester || theratiotester != 0);
1020  assert(!freeStarter || thestarter != 0);
1021 
1022  if(freePricer)
1023  {
1024  delete thepricer;
1025  thepricer = 0;
1026  }
1027 
1028  if(freeRatioTester)
1029  {
1030  delete theratiotester;
1031  theratiotester = 0;
1032  }
1033 
1034  if(freeStarter)
1035  {
1036  delete thestarter;
1037  thestarter = 0;
1038  }
1039 
1040  // free timer
1041  theTime->~Timer();
1042  spx_free(theTime);
1043 }
1044 
1045 
1047 {
1048  if(this != &base)
1049  {
1050  SPxLP::operator=(base);
1051  SPxBasis::operator=(base);
1052  theType = base.theType;
1053  thePricing = base.thePricing;
1054  theRep = base.theRep;
1055  timerType = base.timerType;
1056  maxIters = base.maxIters;
1057  maxTime = base.maxTime;
1058  objLimit = base.objLimit;
1059  m_status = base.m_status;
1066  m_entertol = base.m_entertol;
1067  m_leavetol = base.m_leavetol;
1068  theShift = base.theShift;
1069  lastShift = base.lastShift;
1070  m_maxCycle = base.m_maxCycle;
1071  m_numCycle = base.m_numCycle;
1072  initialized = base.initialized;
1077  displayFreq = base.displayFreq;
1079  unitVecs = base.unitVecs;
1080  primRhs = base.primRhs;
1081  primVec = base.primVec;
1082  dualRhs = base.dualRhs;
1083  dualVec = base.dualVec;
1084  addVec = base.addVec;
1085  theURbound = base.theURbound;
1086  theLRbound = base.theLRbound;
1087  theUCbound = base.theUCbound;
1088  theLCbound = base.theLCbound;
1089  theUBbound = base.theUBbound;
1090  theLBbound = base.theLBbound;
1091  theCoTest = base.theCoTest;
1092  theTest = base.theTest;
1093  primalRay = base.primalRay;
1094  dualFarkas = base.dualFarkas;
1095  leaveCount = base.leaveCount;
1096  enterCount = base.enterCount;
1100  isInfeasible = base.isInfeasible;
1111 
1112  if (base.theRep == COLUMN)
1113  {
1114  thevectors = colSet();
1115  thecovectors = rowSet();
1116  theFrhs = &primRhs;
1117  theFvec = &primVec;
1118  theCoPrhs = &dualRhs;
1119  theCoPvec = &dualVec;
1120  thePvec = &addVec;
1121  theRPvec = theCoPvec;
1122  theCPvec = thePvec;
1123  theUbound = &theUCbound;
1124  theLbound = &theLCbound;
1127  }
1128  else
1129  {
1130  assert(base.theRep == ROW);
1131 
1132  thevectors = rowSet();
1133  thecovectors = colSet();
1134  theFrhs = &dualRhs;
1135  theFvec = &dualVec;
1136  theCoPrhs = &primRhs;
1137  theCoPvec = &primVec;
1138  thePvec = &addVec;
1139  theRPvec = thePvec;
1140  theCPvec = theCoPvec;
1141  theUbound = &theURbound;
1142  theLbound = &theLRbound;
1145  }
1146 
1147  SPxBasis::theLP = this;
1148 
1149  assert(!freePricer || thepricer != 0);
1150  assert(!freeRatioTester || theratiotester != 0);
1151  assert(!freeStarter || thestarter != 0);
1152 
1153  // thepricer
1154  if(freePricer)
1155  {
1156  delete thepricer;
1157  thepricer = 0;
1158  }
1159  if(base.thepricer == 0)
1160  {
1161  thepricer = 0;
1162  freePricer = false;
1163  }
1164  else
1165  {
1166  thepricer = base.thepricer->clone();
1167  freePricer = true;
1168  thepricer->load(this);
1169  }
1170 
1171  // theratiotester
1172  if(freeRatioTester)
1173  {
1174  delete theratiotester;
1175  theratiotester = 0;
1176  }
1177  if(base.theratiotester == 0)
1178  {
1179  theratiotester = 0;
1180  freeRatioTester = false;
1181  }
1182  else
1183  {
1185  freeRatioTester = true;
1186  theratiotester->load(this);
1187  }
1188 
1189  // thestarter
1190  if(freeStarter)
1191  {
1192  delete thestarter;
1193  thestarter = 0;
1194  }
1195  if(base.thestarter == 0)
1196  {
1197  thestarter = 0;
1198  freeStarter = false;
1199  }
1200  else
1201  {
1202  thestarter = base.thestarter->clone();
1203  freeStarter = true;
1204  }
1205 
1206  assert(SPxSolver::isConsistent());
1207  }
1208 
1209  return *this;
1210 }
1211 
1212 
1214  : SPxLP (base)
1215  , SPxBasis(base)
1216  , theType(base.theType)
1217  , thePricing(base.thePricing)
1218  , theRep(base.theRep)
1219  , timerType(base.timerType)
1221  , maxIters(base.maxIters)
1222  , maxTime(base.maxTime)
1225  , objLimit(base.objLimit)
1226  , m_status(base.m_status)
1233  , m_entertol(base.m_entertol)
1234  , m_leavetol(base.m_leavetol)
1235  , theShift(base.theShift)
1236  , lastShift(base.lastShift)
1237  , m_maxCycle(base.m_maxCycle)
1238  , m_numCycle(base.m_numCycle)
1239  , initialized(base.initialized)
1240  , solveVector2 (0)
1242  , solveVector3 (0)
1244  , coSolveVector2(0)
1246  , coSolveVector3(0)
1254  , displayLine(base.displayLine)
1255  , displayFreq(base.displayFreq)
1257  , unitVecs(base.unitVecs)
1258  , primRhs(base.primRhs)
1259  , primVec(base.primVec)
1260  , dualRhs(base.dualRhs)
1261  , dualVec(base.dualVec)
1262  , addVec(base.addVec)
1263  , theURbound(base.theURbound)
1264  , theLRbound(base.theLRbound)
1265  , theUCbound(base.theUCbound)
1266  , theLCbound(base.theLCbound)
1267  , theUBbound(base.theUBbound)
1268  , theLBbound(base.theLBbound)
1269  , theCoTest(base.theCoTest)
1270  , theTest(base.theTest)
1271  , primalRay(base.primalRay)
1272  , dualFarkas(base.dualFarkas)
1273  , leaveCount(base.leaveCount)
1274  , enterCount(base.enterCount)
1275  , primalCount(base.primalCount)
1276  , boundflips(base.boundflips)
1280  , isInfeasible(base.isInfeasible)
1290  , spxout(base.spxout)
1291 {
1293 
1294  if (base.theRep == COLUMN)
1295  {
1296  thevectors = colSet();
1297  thecovectors = rowSet();
1298  theFrhs = &primRhs;
1299  theFvec = &primVec;
1300  theCoPrhs = &dualRhs;
1301  theCoPvec = &dualVec;
1302  thePvec = &addVec;
1303  theRPvec = theCoPvec;
1304  theCPvec = thePvec;
1305  theUbound = &theUCbound;
1306  theLbound = &theLCbound;
1309  }
1310  else
1311  {
1312  assert(base.theRep == ROW);
1313 
1314  thevectors = rowSet();
1315  thecovectors = colSet();
1316  theFrhs = &dualRhs;
1317  theFvec = &dualVec;
1318  theCoPrhs = &primRhs;
1319  theCoPvec = &primVec;
1320  thePvec = &addVec;
1321  theRPvec = thePvec;
1322  theCPvec = theCoPvec;
1323  theUbound = &theURbound;
1324  theLbound = &theLRbound;
1327  }
1328 
1329  SPxBasis::theLP = this;
1330 
1331  if(base.thepricer == 0)
1332  {
1333  thepricer = 0;
1334  freePricer = false;
1335  }
1336  else
1337  {
1338  thepricer = base.thepricer->clone();
1339  freePricer = true;
1340  thepricer->clear();
1341  thepricer->load(this);
1342  }
1343 
1344  if(base.theratiotester == 0)
1345  {
1346  theratiotester = 0;
1347  freeRatioTester = false;
1348  }
1349  else
1350  {
1352  freeRatioTester = true;
1353  theratiotester->clear();
1354  theratiotester->load(this);
1355  }
1356 
1357  if(base.thestarter == 0)
1358  {
1359  thestarter = 0;
1360  freeStarter = false;
1361  }
1362  else
1363  {
1364  thestarter = base.thestarter->clone();
1365  freeStarter = true;
1366  }
1367 
1368  assert(SPxSolver::isConsistent());
1369 }
1370 
1372 {
1373 #ifdef ENABLE_CONSISTENCY_CHECKS
1374  if (epsilon() < 0)
1375  return MSGinconsistent("SPxSolver");
1376 
1378  return MSGinconsistent("SPxSolver");
1379 
1380  if (dualVec.delta().getEpsilon() != addVec.delta().getEpsilon())
1381  return MSGinconsistent("SPxSolver");
1382 
1383  if (unitVecs.size() < SPxLP::nCols() || unitVecs.size() < SPxLP::nRows())
1384  return MSGinconsistent("SPxSolver");
1385 
1386  if (initialized)
1387  {
1388  if (theFrhs->dim() != dim())
1389  return MSGinconsistent("SPxSolver");
1390  if (theFvec->dim() != dim())
1391  return MSGinconsistent("SPxSolver");
1392 
1393  if (theCoPrhs->dim() != dim())
1394  return MSGinconsistent("SPxSolver");
1395  if (thePvec->dim() != coDim())
1396  return MSGinconsistent("SPxSolver");
1397  if (theCoPvec->dim() != dim())
1398  return MSGinconsistent("SPxSolver");
1399 
1400  if (theTest.dim() != coDim())
1401  return MSGinconsistent("SPxSolver");
1402  if (theCoTest.dim() != dim())
1403  return MSGinconsistent("SPxSolver");
1404 
1405  if (theURbound.dim() != SPxLP::nRows())
1406  return MSGinconsistent("SPxSolver");
1407  if (theLRbound.dim() != SPxLP::nRows())
1408  return MSGinconsistent("SPxSolver");
1409  if (theUCbound.dim() != SPxLP::nCols())
1410  return MSGinconsistent("SPxSolver");
1411  if (theLCbound.dim() != SPxLP::nCols())
1412  return MSGinconsistent("SPxSolver");
1413  if (theUBbound.dim() != dim())
1414  return MSGinconsistent("SPxSolver");
1415  if (theLBbound.dim() != dim())
1416  return MSGinconsistent("SPxSolver");
1417  }
1418 
1419  if (rep() == COLUMN)
1420  {
1421  if(thecovectors !=
1422  reinterpret_cast<const SVSet*>(static_cast<const LPRowSet*>(this))
1423  || thevectors !=
1424  reinterpret_cast<const SVSet*>(static_cast<const LPColSet*>(this))
1425  || theFrhs != &primRhs ||
1426  theFvec != &primVec ||
1427  theCoPrhs != &dualRhs ||
1428  theCoPvec != &dualVec ||
1429  thePvec != &addVec ||
1430  theRPvec != theCoPvec ||
1431  theCPvec != thePvec ||
1432  theUbound != &theUCbound ||
1433  theLbound != &theLCbound ||
1434  theCoUbound != &theURbound ||
1435  theCoLbound != &theLRbound)
1436  return MSGinconsistent("SPxSolver");
1437  }
1438  else
1439  {
1440  if (thecovectors
1441  != reinterpret_cast<const SVSet*>(static_cast<const LPColSet*>(this))
1442  || thevectors
1443  != reinterpret_cast<const SVSet*>(static_cast<const LPRowSet*>(this))
1444  || theFrhs != &dualRhs ||
1445  theFvec != &dualVec ||
1446  theCoPrhs != &primRhs ||
1447  theCoPvec != &primVec ||
1448  thePvec != &addVec ||
1449  theRPvec != thePvec ||
1450  theCPvec != theCoPvec ||
1451  theUbound != &theURbound ||
1452  theLbound != &theLRbound ||
1453  theCoUbound != &theUCbound ||
1454  theCoLbound != &theLCbound)
1455  return MSGinconsistent("SPxSolver");
1456  }
1457 
1458  return SPxLP::isConsistent()
1459  && primRhs.isConsistent()
1460  && primVec.isConsistent()
1461  && dualRhs.isConsistent()
1462  && dualVec.isConsistent()
1463  && addVec.isConsistent()
1464  && theTest.isConsistent()
1465  && theCoTest.isConsistent()
1471  ;
1472 #else
1473  return true;
1474 #endif
1475 }
1476 
1477 
1479 {
1480  if( p_time < 0.0 )
1481  p_time = infinity;
1482  maxTime = p_time;
1483 }
1484 
1486 {
1487  return maxTime;
1488 }
1489 
1490 void SPxSolver::setTerminationIter(int p_iteration)
1491 {
1492  if( p_iteration < 0 )
1493  p_iteration = -1;
1494  maxIters = p_iteration;
1495 }
1496 
1498 {
1499  return maxIters;
1500 }
1501 
1502 // returns whether current time limit is reached; call to time() may be skipped unless \p forceCheck is true
1503 bool SPxSolver::isTimeLimitReached(const bool forceCheck)
1504 {
1505  // always update the number of calls, since the user might set a time limit later in the solving process
1506  ++nCallsToTimelim;
1507 
1508  // check if a time limit is actually set
1509  if( maxTime < 0 || maxTime >= infinity )
1510  return false;
1511 
1512  // check if the expensive system call to update the time should be skipped again
1513  if( forceCheck || nCallsToTimelim < NINITCALLS || nClckSkipsLeft <= 0 )
1514  {
1515  Real currtime = time();
1516 
1517  if( currtime >= maxTime )
1518  return true;
1519 
1520  // determine the number of times the clock can be skipped again.
1521  int nClckSkips = MAXNCLCKSKIPS;
1522  Real avgtimeinterval = (currtime + cumulativeTime()) / (Real)(nCallsToTimelim);
1523 
1524  // it would not be safe to skip the clock so many times since we are approaching the time limit
1525  if( SAFETYFACTOR * (maxTime - currtime) / (avgtimeinterval + 1e-6) < nClckSkips )
1526  nClckSkips = 0;
1527  nClckSkipsLeft = nClckSkips;
1528  }
1529  else
1530  --nClckSkipsLeft;
1531 
1532  return false;
1533 }
1534 
1535 
1536 /**@todo A first version for the termination value is
1537  * implemented. Currently we check if no bound violations (shifting)
1538  * is present. It might be even possible to use this termination
1539  * value in case of bound violations (shifting) but in this case it
1540  * is quite difficult to determine if we already reached the limit.
1541  */
1543 {
1544  objLimit = p_value;
1545 }
1546 
1548 {
1549  return objLimit;
1550 }
1551 
1554 {
1555  VarStatus vstat;
1556 
1557  switch( stat )
1558  {
1560  vstat = ON_LOWER;
1561  break;
1563  vstat = ON_UPPER;
1564  break;
1566  vstat = FIXED;
1567  break;
1569  vstat = ZERO;
1570  break;
1576  vstat = BASIC;
1577  break;
1578  default:
1579  MSG_ERROR( std::cerr << "ESOLVE26 ERROR: unknown basis status (" << stat << ")"
1580  << std::endl; )
1581  throw SPxInternalCodeException("XSOLVE22 This should never happen.");
1582  }
1583  return vstat;
1584 }
1585 
1588 {
1589  SPxBasis::Desc::Status rstat;
1590 
1591  switch( stat )
1592  {
1593  case FIXED :
1594  assert(rhs(row) == lhs(row));
1595  rstat = SPxBasis::Desc::P_FIXED;
1596  break;
1597  case ON_UPPER :
1598  assert(rhs(row) < infinity);
1599  rstat = lhs(row) < rhs(row)
1602  break;
1603  case ON_LOWER :
1604  assert(lhs(row) > -infinity);
1605  rstat = lhs(row) < rhs(row)
1608  break;
1609  case ZERO :
1610  /* A 'free' row (i.e., infinite lower & upper bounds) does not really make sense. The user
1611  * might (think to) know better, e.g., when temporarily turning off a row. We therefore apply
1612  * the same adjustment as in the column case in varStatusToBasisStatusCol(). */
1613  if (lhs(row) <= -infinity && rhs(row) >= infinity)
1614  rstat = SPxBasis::Desc::P_FREE;
1615  else
1616  {
1617  if ( lhs(row) == rhs(row) )
1618  {
1619  assert( rhs(row) < infinity );
1620  rstat = SPxBasis::Desc::P_FIXED;
1621  }
1622  else
1623  {
1624  if ( lhs(row) > -infinity )
1626  else
1627  {
1628  assert( rhs(row) < infinity );
1630  }
1631  }
1632  }
1633  break;
1634  case BASIC :
1635  rstat = dualRowStatus(row);
1636  break;
1637  default:
1638  MSG_ERROR( std::cerr << "ESOLVE27 ERROR: unknown VarStatus (" << int(stat) << ")"
1639  << std::endl; )
1640  throw SPxInternalCodeException("XSOLVE23 This should never happen.");
1641  }
1642  return rstat;
1643 }
1644 
1647 {
1648  SPxBasis::Desc::Status cstat;
1649 
1650  switch( stat )
1651  {
1652  case FIXED :
1653  if (upper(col) == lower(col))
1654  cstat = SPxBasis::Desc::P_FIXED;
1655  else if (maxObj(col) > 0.0)
1657  else
1659  break;
1660  case ON_UPPER :
1661  assert(upper(col) < infinity);
1662  cstat = lower(col) < upper(col)
1665  break;
1666  case ON_LOWER :
1667  assert(lower(col) > -infinity);
1668  cstat = lower(col) < upper(col)
1671  break;
1672  case ZERO :
1673  /* In this case the upper and lower bounds on the variable should be infinite. The bounds
1674  * might, however, have changed and we try to recover from this by changing the status to
1675  * 'resonable' settings. A solve has to find the correct values afterwards. Note that the
1676  * approach below is consistent with changesoplex.cpp (e.g., changeUpperStatus() and
1677  * changeLowerStatus() ). */
1678  if (lower(col) <= -infinity && upper(col) >= infinity)
1679  cstat = SPxBasis::Desc::P_FREE;
1680  else
1681  {
1682  if ( lower(col) == upper(col) )
1683  {
1684  assert( upper(col) < infinity );
1685  cstat = SPxBasis::Desc::P_FIXED;
1686  }
1687  else
1688  {
1689  if ( lower(col) > -infinity )
1691  else
1692  {
1693  assert( upper(col) < infinity );
1695  }
1696  }
1697  }
1698  break;
1699  case BASIC :
1700  cstat = dualColStatus(col);
1701  break;
1702  default:
1703  MSG_ERROR( std::cerr << "ESOLVE28 ERROR: unknown VarStatus (" << int(stat) << ")"
1704  << std::endl; )
1705  throw SPxInternalCodeException("XSOLVE24 This should never happen.");
1706  }
1707  return cstat;
1708 }
1709 
1711 {
1712  assert( 0 <= row && row < nRows() );
1713  return basisStatusToVarStatus( desc().rowStatus( row ) );
1714 }
1715 
1717 {
1718  assert( 0 <= col && col < nCols() );
1719  return basisStatusToVarStatus( desc().colStatus( col ) );
1720 }
1721 
1722 SPxSolver::Status SPxSolver::getBasis(VarStatus row[], VarStatus col[], const int rowsSize, const int colsSize) const
1723 {
1724  const SPxBasis::Desc& d = desc();
1725  int i;
1726 
1727  assert(rowsSize < 0 || rowsSize >= nRows());
1728  assert(colsSize < 0 || colsSize >= nCols());
1729 
1730  if (col)
1731  for (i = nCols() - 1; i >= 0; --i)
1732  col[i] = basisStatusToVarStatus( d.colStatus(i) );
1733 
1734  if (row)
1735  for (i = nRows() - 1; i >= 0; --i)
1736  row[i] = basisStatusToVarStatus( d.rowStatus(i) );
1737 
1738  return status();
1739 }
1740 
1742 {
1743 
1744  int basisdim;
1745 
1746  if ( p_rows.size() != nRows() || p_cols.size() != nCols() )
1747  return false;
1748 
1749  basisdim = 0;
1750  for ( int row = nRows()-1; row >= 0; --row )
1751  {
1752  if ( p_rows[row] == UNDEFINED )
1753  return false;
1754  // row is basic
1755  else if ( p_rows[row] == BASIC )
1756  {
1757  basisdim++;
1758  }
1759  // row is nonbasic
1760  else
1761  {
1762  if ( (p_rows[row] == FIXED && lhs(row) != rhs(row))
1763  || (p_rows[row] == ON_UPPER && rhs(row) >= infinity)
1764  || (p_rows[row] == ON_LOWER && lhs(row) <= -infinity) )
1765  return false;
1766  }
1767  }
1768 
1769  for ( int col = nCols()-1; col >= 0; --col )
1770  {
1771  if ( p_cols[col] == UNDEFINED )
1772  return false;
1773  // col is basic
1774  else if ( p_cols[col] == BASIC )
1775  {
1776  basisdim++;
1777  }
1778  // col is nonbasic
1779  else
1780  {
1781  if ( (p_cols[col] == FIXED && lower(col) != upper(col))
1782  || (p_cols[col] == ON_UPPER && upper(col) >= infinity)
1783  || (p_cols[col] == ON_LOWER && lower(col) <= -infinity) )
1784  return false;
1785  }
1786  }
1787 
1788  if ( basisdim != dim() )
1789  return false;
1790 
1791  // basis valid
1792  return true;
1793 }
1794 
1795 void SPxSolver::setBasis(const VarStatus p_rows[], const VarStatus p_cols[])
1796 {
1797 
1799  SPxBasis::load(this);
1800 
1801  SPxBasis::Desc ds = desc();
1802  int i;
1803 
1804  for(i = 0; i < nRows(); i++)
1805  ds.rowStatus(i) = varStatusToBasisStatusRow( i, p_rows[i] );
1806 
1807  for(i = 0; i < nCols(); i++)
1808  ds.colStatus(i) = varStatusToBasisStatusCol( i, p_cols[i] );
1809 
1810  loadBasis(ds);
1812 }
1813 
1814 void SPxSolver::getNdualNorms(int& nnormsRow, int& nnormsCol) const
1815 {
1816  assert(thepricer != NULL);
1817  return thepricer->getNdualNorms(nnormsRow, nnormsCol);
1818 }
1819 
1820 bool SPxSolver::getDualNorms(int& nnormsRow, int& nnormsCol, Real* norms) const
1821 {
1822  assert(thepricer != NULL);
1823  return thepricer->getDualNorms(nnormsRow, nnormsCol, norms);
1824 }
1825 
1826 bool SPxSolver::setDualNorms(int nnormsRow, int nnormsCol, Real* norms)
1827 {
1828  assert(thepricer != NULL);
1829  return thepricer->setDualNorms(nnormsRow, nnormsCol, norms);
1830 }
1831 
1832 
1833 //
1834 // Auxiliary functions.
1835 //
1836 
1837 // Pretty-printing of variable status.
1838 std::ostream& operator<<( std::ostream& os,
1839  const SPxSolver::VarStatus& status )
1840 {
1841  switch( status )
1842  {
1843  case SPxSolver::BASIC:
1844  os << "BASIC";
1845  break;
1846  case SPxSolver::FIXED:
1847  os << "FIXED";
1848  break;
1849  case SPxSolver::ON_LOWER:
1850  os << "ON_LOWER";
1851  break;
1852  case SPxSolver::ON_UPPER:
1853  os << "ON_UPPER";
1854  break;
1855  case SPxSolver::ZERO:
1856  os << "ZERO";
1857  break;
1858  case SPxSolver::UNDEFINED:
1859  os << "UNDEFINED";
1860  break;
1861  default:
1862  os << "?invalid?";
1863  break;
1864  }
1865  return os;
1866 }
1867 
1868 // Pretty-printing of solver status.
1869 std::ostream& operator<<( std::ostream& os,
1870  const SPxSolver::Status& status )
1871 {
1872  switch ( status )
1873  {
1874  case SPxSolver::ERROR:
1875  os << "ERROR";
1876  break;
1878  os << "NO_RATIOTESTER";
1879  break;
1880  case SPxSolver::NO_PRICER:
1881  os << "NO_PRICER";
1882  break;
1883  case SPxSolver::NO_SOLVER:
1884  os << "NO_SOLVER";
1885  break;
1886  case SPxSolver::NOT_INIT:
1887  os << "NOT_INIT";
1888  break;
1890  os << "ABORT_CYCLING";
1891  break;
1892  case SPxSolver::ABORT_TIME:
1893  os << "ABORT_TIME";
1894  break;
1895  case SPxSolver::ABORT_ITER:
1896  os << "ABORT_ITER";
1897  break;
1899  os << "ABORT_VALUE";
1900  break;
1901  case SPxSolver::SINGULAR:
1902  os << "SINGULAR";
1903  break;
1904  case SPxSolver::NO_PROBLEM:
1905  os << "NO_PROBLEM";
1906  break;
1907  case SPxSolver::REGULAR:
1908  os << "REGULAR";
1909  break;
1910  case SPxSolver::RUNNING:
1911  os << "RUNNING";
1912  break;
1913  case SPxSolver::UNKNOWN:
1914  os << "UNKNOWN";
1915  break;
1916  case SPxSolver::OPTIMAL:
1917  os << "OPTIMAL";
1918  break;
1919  case SPxSolver::UNBOUNDED:
1920  os << "UNBOUNDED";
1921  break;
1922  case SPxSolver::INFEASIBLE:
1923  os << "INFEASIBLE";
1924  break;
1925  default:
1926  os << "?other?";
1927  break;
1928  }
1929  return os;
1930 }
1931 
1932 // Pretty-printing of algorithm.
1933 std::ostream& operator<<( std::ostream& os,
1934  const SPxSolver::Type& status )
1935 {
1936  switch ( status )
1937  {
1938  case SPxSolver::ENTER:
1939  os << "ENTER";
1940  break;
1941  case SPxSolver::LEAVE:
1942  os << "LEAVE";
1943  break;
1944  default:
1945  os << "?other?";
1946  break;
1947  }
1948  return os;
1949 }
1950 
1951 // Pretty-printing of representation.
1952 std::ostream& operator<<( std::ostream& os,
1954 {
1955  switch ( status )
1956  {
1957  case SPxSolver::ROW:
1958  os << "ROW";
1959  break;
1960  case SPxSolver::COLUMN:
1961  os << "COLUMN";
1962  break;
1963  default:
1964  os << "?other?";
1965  break;
1966  }
1967  return os;
1968 }
1969 
1970 
1971 } // namespace soplex
void computeFtest()
compute basis feasibility test vector.
Definition: leave.cpp:38
int dim() const
dimension of basis matrix.
Definition: spxsolver.h:936
void clearUpdate()
clear ,
Definition: updatevector.h:160
virtual int terminationIter() const
return iteration limit.
Definition: spxsolver.cpp:1497
int coDim() const
codimension.
Definition: spxsolver.h:941
virtual ~SPxSolver()
Definition: spxsolver.cpp:1016
Desc::Status dualRowStatus(int i) const
dual Status for the i&#39;th row variable of the loaded LP.
Definition: spxbasis.cpp:46
Exception class for things that should NEVER happen.This class is derived from the SoPlex exception b...
Definition: exceptions.h:109
SoPlex start basis generation base class.
virtual Real terminationTime() const
return time limit.
Definition: spxsolver.cpp:1485
Basis is dual feasible.
Definition: spxbasis.h:95
free variable fixed to zero.
Definition: spxsolver.h:182
Safe arrays of data objects.Class DataArray provides safe arrays of Data Objects. For general C++ obj...
Definition: dataarray.h:63
not initialised error
Definition: spxsolver.h:196
Representation rep() const
return the current basis representation.
Definition: spxsolver.h:406
virtual void load(SPxSolver *lp)
loads the LP lp to the basis.
Definition: spxbasis.cpp:305
void reDim(int newdim, const bool setZero=true)
Resets DVectorBase&#39;s dimension to newdim.
Definition: dvectorbase.h:249
Basis is not known to be dual nor primal feasible.
Definition: spxbasis.h:94
void coSolve(Vector &x, const Vector &rhs)
Cosolves linear system with basis matrix.
Definition: spxbasis.h:678
UnitVectorBase< Real > UnitVector
Definition: unitvector.h:29
primal variable is fixed to both bounds
Definition: spxbasis.h:190
int nClckSkipsLeft
remaining number of times the clock can be safely skipped
Definition: spxsolver.h:227
UpdateVector primVec
primal vector
Definition: spxsolver.h:291
SPxOut * spxout
message handler
Definition: slinsolver.h:209
const VectorBase< Real > & maxObj() const
Returns objective vector for maximization problem.
Definition: spxlpbase.h:384
int boundflips
number of performed bound flips
Definition: spxsolver.h:337
primal or dual variable has no status
Definition: spxbasis.h:195
#define DEFAULT_BND_VIOL
default allowed bound violation
Definition: spxdefines.h:208
DIdxSet updateViols
store indices that were changed in the previous iteration and must be checked in hyper pricing ...
Definition: spxsolver.h:363
SPxOut * spxout
message handler
Definition: spxsolver.h:384
bool sparsePricingLeave
These values enable or disable sparse pricing.
Definition: spxsolver.h:374
Type
Algorithmic type.
Definition: spxsolver.h:124
virtual SPxPricer * clone() const =0
clone function for polymorphism
DVector * theUbound
Upper bound for vars.
Definition: spxsolver.h:321
void setBasis(const VarStatus rows[], const VarStatus cols[])
set the lp solver&#39;s basis.
Definition: spxsolver.cpp:1795
UpdateVector addVec
storage for thePvec = &addVec
Definition: spxsolver.h:294
virtual SPxRatioTester * clone() const =0
clone function for polymorphism
int iteration() const
returns number of basis changes since last load().
Definition: spxbasis.h:539
DVector theCoTest
Definition: spxsolver.h:327
Abstract pricer base class.
DVector * theCoUbound
Upper bound for covars.
Definition: spxsolver.h:323
SSVector * solveVector3
when 3 systems are to be solved at a time; typically reserved for bound flipping ratio test (basic so...
Definition: spxsolver.h:250
bool isConsistent() const
Consistency check.
Definition: dvectorbase.h:302
void computeTest()
compute test vector in ENTERing Simplex.
Definition: enter.cpp:102
virtual void setStarter(SPxStarter *starter, const bool destroy=false)
setup starting basis generator to use. If destroy is true, starter will be freed in destructor...
Definition: spxsolver.cpp:154
SPxStatus status() const
returns current SPxStatus.
Definition: spxbasis.h:419
virtual void reDim()
reset dimensions of vectors according to loaded LP.
Definition: spxsolver.cpp:446
UpdateVector dualVec
dual vector
Definition: spxsolver.h:293
Type theType
entering or leaving algortihm.
Definition: spxsolver.h:219
Status & rowStatus(int i)
Definition: spxbasis.h:239
Representation
LP basis representation.
Definition: spxsolver.h:105
bool sparsePricingEnterCo
true if sparsePricing is turned on in the entering Simplex
Definition: spxsolver.h:376
virtual void clear()
clear all data in solver.
Definition: spxsolver.cpp:480
virtual void setRep(SPxSolver::Representation)
sets basis representation.
Definition: spxpricer.h:161
void setType(Type tp)
set LEAVE or ENTER algorithm.
Definition: spxsolver.cpp:169
void clear()
clear vector and update vector
Definition: updatevector.h:153
virtual ~Timer()
Definition: timer.h:124
Abstract ratio test base class.
solve() aborted due to iteration limit.
Definition: spxsolver.h:199
int m_maxCycle
maximum steps before cycling is detected.
Definition: spxsolver.h:244
SPxBasis::Desc::Status varStatusToBasisStatusRow(int row, VarStatus stat) const
converts VarStatus to basis status for rows
Definition: spxsolver.cpp:1587
DataArray< int > isInfeasible
0: index not violated, 1: index violated, 2: index violated and among candidate list ...
Definition: spxsolver.h:370
No Problem has been loaded.
Definition: spxsolver.h:202
void getNdualNorms(int &nnormsRow, int &nnormsCol) const
get number of dual norms
Definition: spxsolver.cpp:1814
bool NE(Real a, Real b, Real eps=Param::epsilon())
returns true iff |a-b| > eps
Definition: spxdefines.h:377
Pricing thePricing
full or partial pricing.
Definition: spxsolver.h:220
void clear()
removes all indices.
Definition: idxset.h:184
UpdateVector & fVec() const
feasibility vector.
Definition: spxsolver.h:1184
Abstract ratio test base class.Class SPxRatioTester is the virtual base class for computing the ratio...
#define SPARSITYFACTOR
Definition: spxsolver.h:39
DVector primRhs
rhs vector for computing the primal vector
Definition: spxsolver.h:290
const VectorBase< Real > & lower() const
Returns lower bound vector.
Definition: spxlpbase.h:420
SPxLPBase< Real > & operator=(const SPxLPBase< Real > &old)
Assignment operator.
Definition: spxlpbase.h:2385
SoPlex start basis generation base class.SPxStarter is the virtual base class for classes generating ...
Definition: spxstarter.h:41
UpdateVector & pVec() const
pricing vector.
Definition: spxsolver.h:1339
virtual bool read(std::istream &in, NameSet *rowNames=0, NameSet *colNames=0, DIdxSet *intVars=0)
Reads LP in LP or MPS format from input stream in.
Definition: spxlpbase.h:1039
void clear()
remove all elements.
Definition: dataarray.h:205
void reDim(int newdim)
reset dimension
Definition: updatevector.h:167
variable fixed to identical bounds.
Definition: spxsolver.h:181
Real sparsePricingFactor
enable sparse pricing when viols < factor * dim()
Definition: spxsolver.h:277
Pricing pricing() const
return current Pricing.
Definition: spxsolver.h:418
LP has been proven to be primal infeasible.
Definition: spxsolver.h:208
void setPrimalBounds()
setup feasibility bounds for entering algorithm
Definition: spxbounds.cpp:32
SSVector * solveVector2rhs
when 2 systems are to be solved at a time; typically for speepest edge weights
Definition: spxsolver.h:249
bool isTimeLimitReached(const bool forceCheck=false)
returns whether current time limit is reached; call to time() may be skipped unless forceCheck is tru...
Definition: spxsolver.cpp:1503
void setOpttol(Real d)
set parameter opttol.
Definition: spxsolver.cpp:916
bool factorized
true iff factor = matrix .
Definition: spxbasis.h:357
bool freeRatioTester
true iff theratiotester should be freed inside of object
Definition: spxsolver.h:258
void setRep()
sets descriptor representation according to loaded LP.
Definition: spxbasis.cpp:286
const SVSetBase< Real > * rowSet() const
Returns the complete SVSet.
Definition: lprowsetbase.h:67
Sparse Linear Solver virtual base class.Class SLinSolver provides a class for solving sparse linear s...
Definition: slinsolver.h:43
#define NINITCALLS
Definition: spxsolver.h:48
const VectorBase< Real > & upper() const
Returns upper bound vector.
Definition: spxlpbase.h:402
Real m_nonbasicValue
nonbasic part of current objective value
Definition: spxsolver.h:232
virtual Real value()
current objective value.
Definition: spxsolver.cpp:863
rowwise representation.
Definition: spxsolver.h:107
bool setDualNorms(int nnormsRow, int nnormsCol, Real *norms)
set dual norms
Definition: spxsolver.cpp:1826
Real lastShift
for forcing feasibility.
Definition: spxsolver.h:243
virtual void computeLeaveCoPrhs()
compute theCoPrhs for leaving Simplex.
Definition: spxvecs.cpp:478
Real opttol() const
allowed optimality, i.e., dual feasibility tolerance.
Definition: spxsolver.h:697
TimerFactory class.
SPxSolver(Type type=LEAVE, Representation rep=ROW, Timer::TYPE ttype=Timer::USER_TIME)
default constructor.
Definition: spxsolver.cpp:949
virtual void setTerminationTime(Real time=infinity)
set time limit.
Definition: spxsolver.cpp:1478
Basis is singular.
Definition: spxbasis.h:93
virtual void setSolver(SLinSolver *slu, const bool destroy=false)
setup linear solver to use. If destroy is true, slusolver will be freed in destructor.
Definition: spxsolver.cpp:83
#define SAFETYFACTOR
Definition: spxsolver.h:47
bool freePricer
true iff thepricer should be freed inside of object
Definition: spxsolver.h:257
Vector & multWithBase(Vector &x) const
Vector-basis product.
Definition: spxbasis.cpp:894
Representation theRep
row or column representation.
Definition: spxsolver.h:221
dual variable is left free, but unset
Definition: spxbasis.h:191
Wrapper for different output streams and verbosity levels.
No ratiotester loaded.
Definition: spxsolver.h:193
No pricer loaded.
Definition: spxsolver.h:194
const Vector & fRhs() const
right-hand side vector for fVec
Definition: spxsolver.h:1197
Entering Simplex.
Definition: spxsolver.h:134
primal variable is set to its upper bound
Definition: spxbasis.h:188
int remainingRoundsLeave
number of dense rounds/refactorizations until sparsePricing is enabled again
Definition: spxsolver.h:380
int m_numCycle
actual number of degenerate steps so far.
Definition: spxsolver.h:245
int maxIters
maximum allowed iterations.
Definition: spxsolver.h:225
Leaving Simplex.
Definition: spxsolver.h:143
Real m_entertol
feasibility tolerance maintained during entering algorithm
Definition: spxsolver.h:240
nothing known about basis status (possibly due to a singular basis in transformed problem) ...
Definition: spxsolver.h:184
const SVSetBase< Real > * colSet() const
Returns the complete SVSetBase.
Definition: lpcolsetbase.h:66
UpdateVector & coPvec() const
copricing vector.
Definition: spxsolver.h:1259
SPxStarter * thestarter
Definition: spxsolver.h:342
SSVector * solveVector3rhs
when 3 systems are to be solved at a time; typically reserved for bound flipping ratio test (basic so...
Definition: spxsolver.h:251
UpdateVector * theRPvec
row pricing vector
Definition: spxsolver.h:316
bool m_pricingViolCoUpToDate
true, if the stored violation in coDim is up to date
Definition: spxsolver.h:238
bool isConsistent() const
check consistency.
Definition: spxsolver.cpp:1371
void reDim()
resizes internal arrays.
double Real
SOPLEX_DEBUG.
Definition: spxdefines.h:200
VarStatus getBasisRowStatus(int row) const
gets basis status for a single row
Definition: spxsolver.cpp:1710
SSVector * coSolveVector3
when 3 systems are to be solved at a time; typically reserved for bound flipping ratio test (basic so...
Definition: spxsolver.h:254
#define MAXNCLCKSKIPS
Definition: spxsolver.h:46
Pricing
Pricing type.
Definition: spxsolver.h:152
DVector * theFrhs
Definition: spxsolver.h:309
#define MSG_DEBUG(x)
Definition: spxdefines.h:127
bool isConsistent() const
consistency check.
Definition: spxbasis.cpp:1094
virtual SPxStarter * clone() const =0
clone function for polymorphism
SPxSolver * solver() const
returns loaded solver.
Definition: spxbasis.h:544
DVector * theLbound
Lower bound for vars.
Definition: spxsolver.h:322
virtual void clear()
unloads LP.
Definition: spxpricer.h:123
Real m_pricingViol
maximal feasibility violation of current solution
Definition: spxsolver.h:235
virtual void unInit()
uninitialize data structures.
Definition: spxsolver.h:1714
Desc::Status dualColStatus(int i) const
dual Status for the i&#39;th column variable of the loaded LP.
Definition: spxbasis.cpp:69
std::ostream & operator<<(std::ostream &s, const VectorBase< R > &vec)
Output operator.
Definition: basevectors.h:1087
UpdateVector * thePvec
Definition: spxsolver.h:314
void testBounds() const
Definition: spxbounds.cpp:305
Status getBasis(VarStatus rows[], VarStatus cols[], const int rowsSize=-1, const int colsSize=-1) const
get current basis, and return solver status.
Definition: spxsolver.cpp:1722
LP has been solved to optimality.
Definition: spxsolver.h:206
Real cumulativeTime() const
cumulative time spent in all calls to method solve().
Definition: spxsolver.h:1963
virtual void setPricer(SPxPricer *pricer, const bool destroy=false)
setup pricer to use. If destroy is true, pricer will be freed in destructor.
Definition: spxsolver.cpp:101
VarStatus getBasisColStatus(int col) const
gets basis status for a single column
Definition: spxsolver.cpp:1716
virtual void setLeaveBounds()
Definition: spxbounds.cpp:291
SPxPricer * thepricer
Definition: spxsolver.h:340
const SVSet * thecovectors
the LP coVectors according to representation
Definition: spxsolver.h:288
int nCols() const
Returns number of columns in LP.
Definition: spxlpbase.h:133
virtual void reinitializeVecs()
setup all vecs fresh
Definition: spxsolver.cpp:264
SPxId instableEnterId
Definition: spxsolver.h:271
dual variable is set to its upper bound
Definition: spxbasis.h:192
solve() aborted due to time limit.
Definition: spxsolver.h:198
DVector theLBbound
Lower Basic Feasibility bound.
Definition: spxsolver.h:307
an error occured.
Definition: spxsolver.h:192
int size() const
return nr. of elements.
Definition: dataarray.h:211
primal variable is left free, but unset
Definition: spxbasis.h:189
virtual SPxSolver * solver() const
returns loaded SPxSolver object.
Definition: spxpricer.h:129
#define MSG_ERROR(x)
Prints out message x if the verbosity level is at least SPxOut::ERROR.
Definition: spxdefines.h:109
SPxSolver & operator=(const SPxSolver &base)
assignment operator
Definition: spxsolver.cpp:1046
int primalCount
number of primal iterations
Definition: spxsolver.h:335
Abstract pricer base class.Class SPxPricer is a pure virtual class defining the interface for pricer ...
Definition: spxpricer.h:46
void shiftPvec()
Perform initial shifting to optain an feasible or pricable basis.
Definition: spxshift.cpp:78
SSVector * coSolveVector3rhs
when 3 systems are to be solved at a time; typically reserved for bound flipping ratio test (basic so...
Definition: spxsolver.h:255
variable set to its upper bound.
Definition: spxsolver.h:179
bool updateNonbasicValue(Real objChange)
Definition: spxsolver.cpp:886
Basis descriptor.
Definition: spxbasis.h:104
Dynamic index set.Class DIdxSet provides dynamic IdxSet in the sense, that no restrictions are posed ...
Definition: didxset.h:42
DVector theURbound
Upper Row Feasibility bound.
Definition: spxsolver.h:296
int dim() const
Dimension of vector.
Definition: vectorbase.h:174
bool freeStarter
true iff thestarter should be freed inside of object
Definition: spxsolver.h:259
bool sparsePricingEnter
true if sparsePricing is turned on in the entering Simplex for slack variables
Definition: spxsolver.h:375
Type type() const
return current Type.
Definition: spxsolver.h:412
int remainingRoundsEnterCo
Definition: spxsolver.h:382
virtual void load(SPxSolver *p_solver)
loads LP.
Real entertol() const
feasibility tolerance maintained by ratio test during ENTER algorithm.
Definition: spxsolver.h:675
static Timer * createTimer(Timer::TYPE ttype)
create timers and allocate memory for them
Definition: timerfactory.h:43
algorithm is running
Definition: spxsolver.h:204
Timer * theTime
time spent in last call to method solve()
Definition: spxsolver.h:222
virtual void setDelta(Real newDelta)
set allowed bound violation
Status & colStatus(int i)
Definition: spxbasis.h:254
Real m_leavetol
feasibility tolerance maintained during leaving algorithm
Definition: spxsolver.h:241
variable set to its lower bound.
Definition: spxsolver.h:180
DVector theUBbound
Upper Basic Feasibility bound.
Definition: spxsolver.h:306
Preconfigured SoPlex LP solver.
Real m_pricingViolCo
maximal feasibility violation of current solution in coDim
Definition: spxsolver.h:237
DVector * theCoLbound
Lower bound for covars.
Definition: spxsolver.h:324
Real length() const
Floating point approximation of euclidian norm (without any approximation guarantee).
Definition: vectorbase.h:356
Debugging, floating point type and parameter definitions.
virtual void loadBasis(const SPxBasis::Desc &)
set a start basis.
Definition: spxsolver.cpp:92
Simplex basis.Consider the linear program as provided from class SPxLP: where , and ...
Definition: spxbasis.h:82
Set of strings.Class NameSet implements a symbol or name table. It allows to store or remove names (i...
Definition: nameset.h:61
int nRows() const
Returns number of rows in LP.
Definition: spxlpbase.h:127
int totalboundflips
total number of bound flips
Definition: spxsolver.h:338
Sequential object-oriented SimPlex.SPxSolver is an LP solver class using the revised Simplex algorith...
Definition: spxsolver.h:84
virtual void load(SPxSolver *p_solver)
loads LP.
Definition: spxpricer.h:117
Full pricing.
Definition: spxsolver.h:160
SSVector * solveVector2
when 2 systems are to be solved at a time; typically for speepest edge weights
Definition: spxsolver.h:248
virtual Real terminationValue() const
return objective limit.
Definition: spxsolver.cpp:1547
DIdxSet infeasibilities
Definition: spxsolver.h:357
DVector theLRbound
Lower Row Feasibility bound.
Definition: spxsolver.h:297
SPxBasis::Desc::Status varStatusToBasisStatusCol(int col, VarStatus stat) const
converts VarStatus to basis status for columns
Definition: spxsolver.cpp:1646
DVector theUCbound
Upper Column Feasibility bound.
Definition: spxsolver.h:298
void setDualColBounds()
Definition: spxbounds.cpp:103
virtual void setTerminationIter(int iteration=-1)
set iteration limit.
Definition: spxsolver.cpp:1490
virtual bool read(std::istream &in, NameSet *rowNames=0, NameSet *colNames=0, DIdxSet *intVars=0)
read LP from input stream.
Definition: spxsolver.cpp:31
Status m_status
status of algorithm.
Definition: spxsolver.h:230
Exception base class.This class implements a base class for our SoPlex exceptions We provide a what()...
Definition: exceptions.h:32
int remainingRoundsEnter
Definition: spxsolver.h:381
const VectorBase< Real > & lhs() const
Returns left hand side vector.
Definition: spxlpbase.h:242
Everything should be within this namespace.
bool isBasisValid(DataArray< VarStatus > rows, DataArray< VarStatus > cols)
check a given basis for validity.
Definition: spxsolver.cpp:1741
TYPE
types of timers
Definition: timer.h:99
bool isConsistent() const
Consistency check.
Definition: spxlpbase.h:1753
bool EQrel(Real a, Real b, Real eps=Param::epsilon())
returns true iff |relDiff(a,b)| <= eps
Definition: spxdefines.h:419
const Vector & coPrhs() const
Right-hand side vector for coPvec.
Definition: spxsolver.h:1272
Real theCumulativeTime
cumulative time spent in all calls to method solve()
Definition: spxsolver.h:224
UpdateVector * theFvec
Definition: spxsolver.h:310
virtual void setTester(SPxRatioTester *tester, const bool destroy=false)
setup ratio-tester to use. If destroy is true, tester will be freed in destructor.
Definition: spxsolver.cpp:128
SSVector * coSolveVector2rhs
when 2 systems are to be solved at a time; typically for speepest edge weights
Definition: spxsolver.h:253
virtual bool setDualNorms(int nrows, int ncols, Real *norms)
import norms into pricer
Definition: spxpricer.h:314
solve() aborted due to detection of cycling.
Definition: spxsolver.h:197
SPxBasis & operator=(const SPxBasis &rhs)
assignment operator
Definition: spxbasis.cpp:1227
virtual Real maxInfeas() const
maximal infeasibility of basis
Definition: spxsolver.cpp:630
primal variable is set to its lower bound
Definition: spxbasis.h:187
bool m_nonbasicValueUpToDate
true, if the stored objValue is up to date
Definition: spxsolver.h:233
Real feastol() const
allowed primal feasibility tolerance.
Definition: spxsolver.h:689
Exception class for incorrect usage of interface methods.
Definition: exceptions.h:126
SPxSolver * theLP
the LP
Definition: spxbasis.h:343
VarStatus basisStatusToVarStatus(SPxBasis::Desc::Status stat) const
converts basis status to VarStatus
Definition: spxsolver.cpp:1553
DVector theLCbound
Lower Column Feasibility bound.
Definition: spxsolver.h:299
virtual void clearUpdateVecs(void)
Definition: spxsolver.cpp:510
int leaveCount
number of LEAVE iterations
Definition: spxsolver.h:333
nothing known on loaded problem.
Definition: spxsolver.h:205
Vector & multBaseWith(Vector &x) const
Basis-vector product.
Definition: spxbasis.cpp:931
virtual void factorize()
factorizes the basis matrix.
Definition: spxbasis.cpp:845
variable is basic.
Definition: spxsolver.h:183
virtual void loadSolver(SLinSolver *solver, const bool destroy=false)
sets up linear solver to use.
Definition: spxbasis.cpp:319
void computeFrhs()
compute feasibility vector from scratch.
Definition: spxvecs.cpp:42
void setDualRowBounds()
Definition: spxbounds.cpp:133
void clear()
Set vector to 0.
Definition: vectorbase.h:219
Status status() const
Status of solution process.
Definition: spxsolve.cpp:1536
SPxRatioTester * theratiotester
Definition: spxsolver.h:341
Real epsilon() const
values are considered to be 0.
Definition: spxsolver.h:670
void shiftFvec()
Perform initial shifting to optain an feasible or pricable basis.
Definition: spxshift.cpp:25
DVector * theCoPrhs
Definition: spxsolver.h:312
SPxSense spxSense() const
Returns the optimization sense.
Definition: spxlpbase.h:438
dual variable is set to its lower bound
Definition: spxbasis.h:193
virtual bool noViols(Real tol) const
check for violations above tol and immediately return false w/o checking the remaining values ...
Definition: spxsolver.cpp:675
DSVector primalRay
stores primal ray in case of unboundedness
Definition: spxsolver.h:330
virtual void loadDesc(const Desc &)
sets up basis.
Definition: spxbasis.cpp:188
DataArray< int > isInfeasibleCo
0: index not violated, 1: index violated, 2: index violated and among candidate list ...
Definition: spxsolver.h:371
Real theShift
sum of all shifts applied to any bound.
Definition: spxsolver.h:242
const Real infinity
Definition: spxdefines.cpp:26
R getEpsilon() const
Returns the non-zero epsilon used.
Definition: ssvectorbase.h:104
bool hyperPricingEnter
true if hyper sparse pricing is turned on in the entering Simplex
Definition: spxsolver.h:378
const VectorBase< Real > & rhs() const
Returns right hand side vector.
Definition: spxlpbase.h:224
bool isInitialized() const
has the internal data been initialized?
Definition: spxsolver.h:1705
DSVector dualFarkas
stores dual farkas proof in case of infeasibility
Definition: spxsolver.h:331
int enterCount
number of ENTER iterations
Definition: spxsolver.h:334
Array< UnitVector > unitVecs
array of unit vectors
Definition: spxsolver.h:286
const SVSet * thevectors
the LP vectors according to representation
Definition: spxsolver.h:287
virtual void setEnterBounds()
Definition: spxbounds.cpp:209
dual variable has two bounds
Definition: spxbasis.h:194
Real maxTime
maximum allowed time.
Definition: spxsolver.h:226
Exception class for status exceptions during the computationsThis class is derived from the SoPlex ex...
Definition: exceptions.h:89
void setFeastol(Real d)
set parameter feastol.
Definition: spxsolver.cpp:904
virtual void loadLP(const SPxLP &LP)
copy LP.
Definition: spxsolver.cpp:68
virtual void init()
intialize data structures.
Definition: spxsolver.cpp:317
bool initialized
true, if all vectors are setup.
Definition: spxsolver.h:246
virtual void computeEnterCoPrhs()
compute theCoPrhs for entering Simplex.
Definition: spxvecs.cpp:405
const Desc & desc() const
Definition: spxbasis.h:457
void forceRecompNonbasicValue()
Definition: spxsolver.h:545
#define MSGinconsistent(name)
Definition: spxdefines.h:121
void solve(Vector &x, const Vector &rhs)
Definition: spxbasis.h:605
void initRep(Representation p_rep)
initialize ROW or COLUMN representation.
Definition: spxsolver.cpp:198
SSVector & delta()
update vector , writeable
Definition: updatevector.h:122
DIdxSet updateViolsCo
Definition: spxsolver.h:364
#define MSG_INFO3(spxout, x)
Prints out message x if the verbosity level is at least SPxOut::INFO3.
Definition: spxdefines.h:117
bool m_pricingViolUpToDate
true, if the stored violation is up to date
Definition: spxsolver.h:236
void hyperPricing(bool h)
enable or disable hyper sparse pricing
Definition: spxsolver.cpp:938
void setMax(int newmax=1)
sets the maximum number of indices.
Definition: didxset.cpp:22
Real objLimit
< the number of calls to the method isTimeLimitReached()
Definition: spxsolver.h:229
virtual void clear()
clears the LP.
Definition: spxlpbase.h:1007
void computePvec()
compute entire pVec().
Definition: spxvecs.cpp:498
virtual void setTerminationValue(Real value=infinity)
set objective limit.
Definition: spxsolver.cpp:1542
virtual void unLoad()
unloads the LP from the basis.
Definition: spxbasis.h:822
UpdateVector * theCoPvec
Definition: spxsolver.h:313
virtual void clear()
unloads LP.
Status
Status of a variable.
Definition: spxbasis.h:185
SSVector * coSolveVector2
when 2 systems are to be solved at a time; typically for speepest edge weights
Definition: spxsolver.h:252
virtual void reLoad()
reload LP.
Definition: spxsolver.cpp:55
bool getDualNorms(int &nnormsRow, int &nnormsCol, Real *norms) const
get dual norms
Definition: spxsolver.cpp:1820
Real time() const
time spent in last call to method solve().
Definition: spxsolver.h:1953
void reSize(int newsize)
reset size to newsize.
Definition: dataarray.h:223
DIdxSet infeasibilitiesCo
Definition: spxsolver.h:360
DVector dualRhs
rhs vector for computing the dual vector
Definition: spxsolver.h:292
bool hyperPricingLeave
true if hyper sparse pricing is turned on in the leaving Simplex
Definition: spxsolver.h:377
Real leavetol() const
feasibility tolerance maintained by ratio test during LEAVE algorithm.
Definition: spxsolver.h:682
bool isConsistent() const
Real nonbasicValue()
Compute part of objective value.
Definition: spxsolver.cpp:711
solve() aborted due to objective limit.
Definition: spxsolver.h:200
columnwise representation.
Definition: spxsolver.h:108
void spx_free(T &p)
Release memory.
Definition: spxalloc.h:109
const VectorBase< Real > & maxRowObj() const
Definition: spxlpbase.h:286
Basis is singular, numerical troubles?
Definition: spxsolver.h:201
UpdateVector * theCPvec
column pricing vector
Definition: spxsolver.h:317
virtual void factorize()
Factorize basis matrix.
Definition: spxsolver.cpp:525
Basis is primal feasible.
Definition: spxbasis.h:96
virtual bool getDualNorms(int &nrows, int &ncols, Real *norms) const
export norms from pricer
Definition: spxpricer.h:276
void resetClockStats()
resets clock average statistics
Definition: spxsolver.cpp:310
LP has a usable Basis (maybe LP is changed).
Definition: spxsolver.h:203
virtual void getNdualNorms(int &nrows, int &ncols) const
get number of available norms
Definition: spxpricer.h:250
bool matrixIsSetup
true iff the pointers in matrix are set up correctly.
Definition: spxbasis.h:349
void setBasisStatus(SPxBasis::SPxStatus stat)
set the lp solver&#39;s basis status.
Definition: spxsolver.h:1905
void setPricing(Pricing pr)
set FULL or PARTIAL pricing.
Definition: spxsolver.cpp:431
LP has been proven to be primal unbounded.
Definition: spxsolver.h:207
No Problem has been loaded to the basis.
Definition: spxbasis.h:92
No linear solver loaded.
Definition: spxsolver.h:195
void setDelta(Real d)
set parameter delta, i.e., set feastol and opttol to same value.
Definition: spxsolver.cpp:928
Timer::TYPE timerType
type of timer (user or wallclock)
Definition: spxsolver.h:223
void computeCoTest()
compute coTest vector.
Definition: enter.cpp:228
#define MAXIMUM(x, y)
Definition: spxdefines.h:228