Scippy

SoPlex

Sequential object-oriented simPlex

soplexlegacy.cpp
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the class library */
4 /* SoPlex --- the Sequential object-oriented simPlex. */
5 /* */
6 /* Copyright (C) 1996-2017 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SoPlex is distributed under the terms of the ZIB Academic Licence. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SoPlex; see the file COPYING. If not email to soplex@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 #include <iostream>
17 
18 #include "soplexlegacy.h"
19 #include "exceptions.h"
20 
21 namespace soplex
22 {
24  : m_solver(p_type, p_rep)
25  , m_postScaler(0)
26  , m_simplifier(0)
27  , m_vanished(false)
28  , m_freePreScaler(false)
29  , m_freePostScaler(false)
30  , m_freeSimplifier(false)
31 {
32  m_solver.setOutstream(outstream);
35  m_solver.setPricer(new SPxSteepPR(), true);
37 
39 }
40 
42 {
43  assert(!m_freePostScaler || m_postScaler != 0);
44  assert(!m_freeSimplifier || m_simplifier != 0);
45 
47  {
48  delete m_postScaler;
49  m_postScaler = 0;
50  }
51 
53  {
54  delete m_simplifier;
55  m_simplifier = 0;
56  }
57 }
58 
60 {
61  assert(!m_freePostScaler || m_postScaler != 0);
62  assert(!m_freeSimplifier || m_simplifier != 0);
63 
64  if(this != &base)
65  {
66  SPxLP::operator=(base);
67  m_slu = base.m_slu; // call of SLinSolver::clone() SPxBasis assignment operator not necessary (done by m_solver.setSolver(&m_slu) below)
68  m_solver = base.m_solver;
69  m_vanished = base.m_vanished;
71 
72  // m_postScaler
74  {
75  delete m_postScaler;
76  m_postScaler = 0;
77  }
78  if(base.m_postScaler == 0)
79  {
80  m_postScaler = 0;
81  m_freePostScaler = false;
82  }
83  else
84  {
86  m_freePostScaler = true;
87  }
88 
89  // m_simplifier
91  {
92  delete m_simplifier;
93  m_simplifier = 0;
94  }
95  if(base.m_simplifier == 0)
96  {
97  m_simplifier = 0;
98  m_freeSimplifier = false;
99  }
100  else
101  {
102  m_simplifier = base.m_simplifier->clone();
103  m_freeSimplifier = true;
104  }
105 
106 
107  }
108 
109  return *this;
110 }
111 
112 
114  : SPxLP(old)
115  , m_slu(old.m_slu) // call of SLinSolver::clone() SPxBasis copy constructor not necessary (done by m_solver.setSolver(&m_slu) below)
116  , m_solver(old.m_solver)
117  , m_vanished(old.m_vanished)
118 {
120 
121  // m_postScaler
122  if(old.m_postScaler == 0)
123  {
124  m_postScaler = 0;
125  m_freePostScaler = false;
126  }
127  else
128  {
130  m_freePostScaler = true;
131  }
132 
133  // m_simplifier
134  if(old.m_simplifier == 0)
135  {
136  m_simplifier = 0;
137  m_freeSimplifier = false;
138  }
139  else
140  {
142  m_freeSimplifier = true;
143  }
144 }
145 
146 
147 
148 void SoPlexLegacy::setPostScaler(SPxScaler* x, const bool destroy)
149 {
150 
151  assert(!m_freePostScaler || m_postScaler != 0);
152 
153  if(m_freePostScaler)
154  {
155  delete m_postScaler;
156  m_postScaler = 0;
157  }
158  m_postScaler = x;
159  if( m_postScaler )
161  m_freePostScaler = destroy;
162 }
163 
164 void SoPlexLegacy::setSimplifier(SPxSimplifier* x, const bool destroy)
165 {
166 
167  assert(!m_freeSimplifier || m_simplifier != 0);
168 
169  if(m_freeSimplifier)
170  {
171  delete m_simplifier;
172  m_simplifier = 0;
173  }
174  m_simplifier = x;
175  m_freeSimplifier = destroy;
176 }
177 
179 {
180 
181  DVector x(nCols());
182 
183  getPrimal(x);
184 
185  return x * maxObj() * Real(spxSense());
186 }
187 
189 {
190 
191  if (nRows() <= 0 && nCols() <= 0) // no problem loaded
192  throw SPxStatusException("XSOLVR01 No Problem loaded");
193 
194  // assume presolver did NOT solve problem
195  m_vanished = false;
196 
197  // working LP
198  SPxLP work(*this);
199  work.setOutstream(*spxout);
200 
201  // keep useful bounds for bfrt
202  bool keepbounds = (!strcmp(m_solver.ratiotester()->getName(), "Bound Flipping"));
203 
204  // should the LP be simplified ?
205  if (m_simplifier != 0)
206  {
207  switch(m_simplifier->simplify(work, m_solver.epsilon(), m_solver.feastol(), m_solver.opttol(), keepbounds))
208  {
211  return SPxSolver::UNBOUNDED;
214  return SPxSolver::INFEASIBLE;
216  m_vanished = true;
217  return SPxSolver::OPTIMAL;
218  case SPxSimplifier::OKAY:
219  break;
220  default:
221  throw SPxInternalCodeException("XRSOLVR01 This should never happen.");
222  }
223  }
224 
225  // should the LP be scaled after simplifing?
226  if (m_postScaler != 0)
227  m_postScaler->scale(work, false);
228 
229  /* if a basis of correct size was set externally, try to load it into the transformed LP */
230  if ( m_colsbasisstatus.size() == work.nCols() && m_rowsbasisstatus.size() == work.nRows() )
231  {
232  m_solver.loadLP(work);
234  {
236  }
239  }
240  /* if a basis with status at least REGULAR exists (loaded via readBasisFile()
241  * or available from previous simplex run), we check whether it can be (re)used
242  * for the newly loaded LP.
243  */
244  else if ( m_solver.basis().status() <= SPxBasis::SINGULAR )
245  {
246  m_solver.loadLP(work);
247  }
248  else
249  {
250  SPxBasis::Desc oldbasisdesc(m_solver.basis().desc());
251  m_solver.loadLP(work);
252  if(m_solver.basis().isDescValid(oldbasisdesc))
253  m_solver.loadBasis(oldbasisdesc);
254  }
255 
256  return m_solver.solve();
257 }
258 
260 {
261 
262  if (has_simplifier())
263  {
265  unsimplify();
266 
268 
269  if (m_vanished)
270  return SPxSolver::OPTIMAL;
271  else
272  return m_solver.status();
273  }
274 
275  // else
277 
278  // unscale postscaling
279  if (m_postScaler != 0)
281 
282  return stat;
283 }
284 
286 {
287 
288  if (has_simplifier())
289  {
291  unsimplify();
292 
294 
295  if (m_vanished)
296  return SPxSolver::OPTIMAL;
297  else
298  return m_solver.status();
299  }
300 
301  // else
303 
304  // unscale postscaling
305  if (m_postScaler != 0)
307 
308  return stat;
309 }
310 
312 {
313 
314  if (has_simplifier())
315  {
317  unsimplify();
318 
320 
321  if (m_vanished)
322  return SPxSolver::OPTIMAL;
323  else
324  return m_solver.status();
325  }
326 
327  // else
329 
330  // unscale postscaling
331  if (m_postScaler != 0)
333 
334  return stat;
335 }
336 
338 {
339 
340  if (has_simplifier())
341  {
343  unsimplify();
344 
345  rdcost = m_simplifier->unsimplifiedRedCost();
346 
347  if (m_vanished)
348  return SPxSolver::OPTIMAL;
349  else
350  return m_solver.status();
351  }
352 
353  // else
354  SPxSolver::Status stat = m_solver.getRedCost(rdcost);
355 
356  // unscale postscaling
357  if (m_postScaler != 0)
359 
360  return stat;
361 }
362 
364 {
366  if((b_status == SPxBasis::NO_PROBLEM || (has_simplifier() && b_status == SPxBasis::SINGULAR)) && !m_vanished)
367  return SPxSolver::UNDEFINED;
368 
369  if (has_simplifier())
370  {
372  unsimplify();
373 
374  return m_simplifier->getBasisRowStatus(i);
375  }
376  else
377  return m_solver.getBasisRowStatus(i);
378 }
379 
381 {
383  if((b_status == SPxBasis::NO_PROBLEM || (has_simplifier() && b_status == SPxBasis::SINGULAR)) && !m_vanished)
384  return SPxSolver::UNDEFINED;
385 
386  if (has_simplifier())
387  {
389  unsimplify();
390 
391  return m_simplifier->getBasisColStatus(j);
392  }
393  else
394  return m_solver.getBasisColStatus(j);
395 }
396 
398 {
400  if((b_status == SPxBasis::NO_PROBLEM || (has_simplifier() && b_status == SPxBasis::SINGULAR)) && !m_vanished)
401  {
402  int i;
403 
404  if (cols)
405  for (i = nCols() - 1; i >= 0; --i)
406  cols[i] = SPxSolver::UNDEFINED;
407 
408  if (rows)
409  for (i = nRows() - 1; i >= 0; --i)
410  rows[i] = SPxSolver::UNDEFINED;
411 
412  return m_solver.status();
413  }
414 
415  if (has_simplifier())
416  {
418  unsimplify();
419 
420  m_simplifier->getBasis(rows, cols);
421  return m_solver.status();
422  }
423 
424  else
425  return m_solver.getBasis(rows, cols);
426 }
427 
429 {
430  /// Does not work yet with presolve
431  if (has_simplifier())
432  {
433  MSG_ERROR( std::cerr << "ESOLVR02 Primal ray with presolving not yet implemented" << std::endl; )
434  throw SPxStatusException("XSOLVR02 Primal ray with presolving not yet implemented");
435  }
436  SPxSolver::Status stat = m_solver.getPrimalray(primalray);
437 
438  if (m_postScaler != 0)
439  m_postScaler->unscalePrimal(m_solver, primalray);
440 
441  return stat;
442 }
443 
445 {
446  /// Does not work yet with presolve
447  if (has_simplifier())
448  {
449  MSG_ERROR( std::cerr << "ESOLVR02 Dual farkas with presolving not yet implemented" << std::endl; )
450  throw SPxStatusException("XSOLVR03 Dual farkas with presolving not yet implemented");
451  // return SPxSolver::ERROR;
452  }
453  SPxSolver::Status stat = m_solver.getDualfarkas(dualfarkas);
454 
455  if (m_postScaler != 0)
456  m_postScaler->unscaleDual(m_solver, dualfarkas);
457 
458  return stat;
459 }
460 
462  Real& maxviol,
463  Real& sumviol) const
464 {
465  maxviol = 0.0;
466  sumviol = 0.0;
467 
468  DVector solu( nCols() );
469 
470  getPrimal( solu );
471 
472  for( int row = 0; row < nRows(); ++row )
473  {
474  const SVector& rowvec = rowVector( row );
475 
476  Real val = 0.0;
477 
478  for( int col = 0; col < rowvec.size(); ++col )
479  val += rowvec.value( col ) * solu[rowvec.index( col )];
480 
481  Real viol = 0.0;
482 
483  assert(lhs( row ) <= rhs( row ));
484 
485  if (val < lhs( row ))
486  viol = spxAbs(val - lhs( row ));
487  else
488  if (val > rhs( row ))
489  viol = spxAbs(val - rhs( row ));
490 
491  if (viol > maxviol)
492  maxviol = viol;
493 
494  sumviol += viol;
495  }
496 }
497 
499  Real& maxviol,
500  Real& sumviol) const
501 {
502  maxviol = 0.0;
503  sumviol = 0.0;
504 
505  DVector solu( nCols() );
506 
507  getPrimal( solu );
508 
509  for( int col = 0; col < nCols(); ++col )
510  {
511  assert( lower( col ) <= upper( col ));
512 
513  Real viol = 0.0;
514 
515  if (solu[col] < lower( col ))
516  viol = spxAbs( solu[col] - lower( col ));
517  else
518  if (solu[col] > upper( col ))
519  viol = spxAbs( solu[col] - upper( col ));
520 
521  if (viol > maxviol)
522  maxviol = viol;
523 
524  sumviol += viol;
525  }
526 }
527 
529  const char* filename,
530  const NameSet* rowNames,
531  const NameSet* colNames
532  )
533 {
534  // init solver using original LP
535  m_solver.loadLP(*this);
536  return m_solver.readBasisFile(filename, rowNames, colNames);
537 }
538 
540  const char* filename,
541  const NameSet* rowNames,
542  const NameSet* colNames
543  )
544 {
545  assert(rep() == SPxSolver::COLUMN);
546 
547  /* make sure the basis of the original problem is written */
548  unsimplify();
549 
550  std::ofstream file(filename);
551  std::ostream& os = file;
552 
553  os.setf(std::ios::left);
554  os << "NAME soplex.bas\n";
555 
556  /* do not write basis if there is none */
557  if( status() == SPxSolver::NO_PROBLEM )
558  {
559  os << "ENDATA" << std::endl;
560  return true;
561  }
562 
563  /* start writing */
564  char buf[255];
565  int row = 0;
566  for( int col = 0; col < nCols(); col++ )
567  {
568  if( getBasisColStatus(col) == SPxSolver::BASIC )
569  {
570  /* Find non basic row */
571  for( ; row < nRows(); row++ )
572  {
573  if( getBasisRowStatus(row) != SPxSolver::BASIC )
574  break;
575  }
576 
577  assert(row != nRows());
578 
579  os << ( getBasisRowStatus(row) == SPxSolver::ON_UPPER ? " XU " : " XL " )
580  << std::setw(8) << getColName(col, colNames, buf);
581 
582  /* break in two parts since buf is reused */
583  os << " "
584  << getRowName(row, rowNames, buf)
585  << std::endl;
586 
587  row++;
588  }
589  else
590  {
592  {
593  os << " UL "
594  << getColName(col, colNames, buf)
595  << std::endl;
596  }
597  }
598  }
599 
600  #ifndef NDEBUG
601  // Check that we covered all nonbasic rows - the remaining should be basic.
602  for( ; row < nRows(); row++ )
603  {
604  if( getBasisRowStatus(row) != SPxSolver::BASIC )
605  break;
606  }
607  assert(row == nRows());
608  #endif // NDEBUG
609 
610  os << "ENDATA" << std::endl;
611  return true;
612 }
613 
615  const char* filename,
616  const NameSet* rowNames,
617  const NameSet* colNames ) const
618 {
619 
620  return m_solver.writeState(filename, rowNames, colNames);
621 }
622 
624 {
626  return;
627 
628  DVector psp_x(m_solver.nCols()); // primal solution (prescaled simplified postscaled)
629  DVector psp_y(m_solver.nRows()); // dual solution (prescaled simplified postscaled)
630  DVector psp_s(m_solver.nRows()); // slacks (prescaled simplified postscaled)
631  DVector psp_r(m_solver.nCols()); // reduced costs (prescaled simplified postscaled)
632 
633  if (! m_vanished) {
634  // If solver status is not regular or optimal, do nothing.
635  const SPxSolver::Status stat = status();
636  if( stat != SPxSolver::OPTIMAL && stat != SPxSolver::REGULAR )
637  return;
638 
639  m_solver.getPrimal(psp_x);
640  m_solver.getDual(psp_y);
641  m_solver.getSlacks(psp_s);
642  m_solver.getRedCost(psp_r);
643 
644  // unscale postscaling
645  if (m_postScaler != 0)
646  {
651  }
652  }
653  else {
654  // If there is no sensible solution, do nothing.
655  const SPxSolver::Status stat = status();
656  if (stat != SPxSolver::OPTIMAL)
657  return;
658 
659  psp_x.reDim(0);
660  psp_y.reDim(0);
661  psp_s.reDim(0);
662  psp_r.reDim(0);
663  }
664 
665  // unsimplify
666  if(m_vanished)
667  {
668  m_simplifier->unsimplify(psp_x, psp_y, psp_s, psp_r, NULL, NULL);
669  }
670  else
671  {
672  SPxSolver::VarStatus *rows, *cols;
673  rows = NULL;
674  cols = NULL;
675  try
676  {
677  spx_alloc(rows, m_solver.nRows());
678  spx_alloc(cols, m_solver.nCols());
679 
680  m_solver.getBasis(rows, cols, m_solver.nRows(), m_solver.nCols());
681  m_simplifier->unsimplify(psp_x, psp_y, psp_s, psp_r, rows, cols);
682  }
683  catch( const SPxMemoryException& x)
684  {
685  spx_free(rows);
686  spx_free(cols);
687  throw x;
688  }
689 
690  spx_free(rows);
691  spx_free(cols);
692  }
693 }
694 } // namespace soplex
const VectorBase< R > & rhs() const
Returns right hand side vector.
Definition: spxlpbase.h:219
Rational spxAbs(const Rational &r)
Absolute.
Definition: rational.cpp:3909
SPxSolver::Status getBasis(SPxSolver::VarStatus rows[], SPxSolver::VarStatus cols[]) const
get current basis, and return solver status.
virtual const Vector & unsimplifiedSlacks()=0
returns a reference to the unsimplified slack values.
Exception class for things that should NEVER happen.This class is derived from the SoPlex exception b...
Definition: exceptions.h:109
Bound flipping ratio test ("long step dual") for SoPlex.Class SPxBoundFlippingRT provides an implemen...
virtual void unscalePrimal(const SPxLPBase< Real > &lp, Vector &x) const
unscale dense primal solution vector given in x.
Definition: spxscaler.cpp:609
SPxBasis::SPxStatus getBasisStatus() const
gets basis status
Definition: spxsolver.h:2004
const VectorBase< R > & upper() const
Returns upper bound vector.
Definition: spxlpbase.h:456
virtual SPxSolver::VarStatus getBasisColStatus(int) const =0
gets basis status for a single column.
virtual Status getPrimal(Vector &vector) const
get solution vector for primal variables.
Definition: spxsolve.cpp:1562
Type
Algorithmic type.
Definition: spxsolver.h:124
void setOutstream(SPxOut &newOutstream)
Definition: spxlpbase.h:125
const SPxRatioTester * ratiotester() const
return loaded SPxRatioTester.
Definition: spxsolver.h:1747
the problem was so much simplified that it vanished
Definition: spxsimplifier.h:87
void setBasis(const VarStatus rows[], const VarStatus cols[])
set the lp solver&#39;s basis.
Definition: spxsolver.cpp:1863
virtual Result simplify(SPxLP &lp, Real eps, Real delta)=0
simplify SPxLP lp with identical primal and dual feasibility tolerance.
int size() const
Number of used indices.
Definition: svectorbase.h:152
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:1790
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
Real feastol() const
allowed primal feasibility tolerance.
Definition: spxsolver.h:777
virtual void setBasisSolver(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
Exception classes for SoPlex.
virtual bool isDescValid(const Desc &ds)
checks if a Descriptor is valid for the current LP w.r.t. its bounds
Definition: spxbasis.cpp:111
Representation
LP basis representation.
Definition: spxsolver.h:105
SPxSolver::VarStatus getBasisRowStatus(int row) const
gets basis status for a single row.
SPxSimplifier * m_simplifier
simplifier
Definition: soplexlegacy.h:52
No Problem has been loaded.
Definition: spxsolver.h:216
virtual void unscaleRedCost(const SPxLPBase< Real > &lp, Vector &r) const
unscale dense reduced cost vector given in r.
Definition: spxscaler.cpp:645
virtual void unscaleDual(const SPxLPBase< Real > &lp, Vector &pi) const
unscale dense dual solution vector given in pi.
Definition: spxscaler.cpp:633
SPxLPBase< Real > & operator=(const SPxLPBase< Real > &old)
Assignment operator.
Definition: spxlpbase.h:2581
virtual SPxSolver::Status getPrimal(Vector &vector) const
bool m_vanished
did the presolver solve the problem ?
Definition: soplexlegacy.h:53
void clear()
remove all elements.
Definition: dataarray.h:205
LP has been proven to be primal infeasible.
Definition: spxsolver.h:222
R & value(int n)
Reference to value of n &#39;th nonzero.
Definition: svectorbase.h:254
virtual bool readBasisFile(const char *filename, const NameSet *rowNames, const NameSet *colNames)
Definition: spxfileio.cpp:24
virtual SPxSolver::VarStatus getBasisRowStatus(int) const =0
gets basis status for a single row.
SPxSolver::Representation rep() const
return current basis representation.
Definition: soplexlegacy.h:113
Basis is singular.
Definition: spxbasis.h:93
int nRows() const
Returns number of rows in LP.
Definition: spxlpbase.h:151
Exception class for out of memory exceptions.This class is derived from the SoPlex exception base cla...
Definition: exceptions.h:70
void spx_alloc(T &p, int n=1)
Allocate memory.
Definition: spxalloc.h:48
simplification could be done
Definition: spxsimplifier.h:83
virtual SPxSimplifier * clone() const =0
clone function for polymorphism
virtual Status getDualfarkas(Vector &vector) const
get dual farkas proof of infeasibility.
Definition: spxsolve.cpp:1703
virtual void setOutstream(SPxOut &newOutstream)
set message handler
Definition: spxscaler.h:137
nothing known about basis status (possibly due to a singular basis in transformed problem) ...
Definition: spxsolver.h:196
SPxStatus status() const
returns current SPxStatus.
Definition: spxbasis.h:425
bool has_simplifier() const
has a simplifier been set?
Definition: soplexlegacy.h:132
double Real
Definition: spxdefines.h:215
virtual SPxScaler * clone() const =0
clone function for polymorphism
virtual void setPostScaler(SPxScaler *scaler, const bool destroy=false)
setup postscaler to use. If destroy is true, scaler will be freed in destructor.
SoPlexLegacy(SPxOut &outstream, SPxSolver::Type type=SPxSolver::LEAVE, SPxSolver::Representation rep=SPxSolver::COLUMN)
default construtor.
SoPlexLegacy & operator=(const SoPlexLegacy &rhs)
assignment operator.
Status status() const
Status of solution process.
Definition: spxsolve.cpp:1879
const char * getColName(int idx, const NameSet *cnames, char *buf)
Definition: soplexlegacy.h:268
SPxSense spxSense() const
Returns the optimization sense.
Definition: spxlpbase.h:510
int & index(int n)
Reference to index of n &#39;th nonzero.
Definition: svectorbase.h:236
LP simplification abstract base class.Instances of classes derived from SPxSimplifier may be loaded t...
Definition: spxsimplifier.h:41
LP has been solved to optimality.
Definition: spxsolver.h:220
virtual bool writeState(const char *filename, const NameSet *rowNames=NULL, const NameSet *colNames=NULL) const
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:103
#define MSG_ERROR(x)
Prints out message x if the verbosity level is at least SPxOut::ERROR.
Definition: spxdefines.h:111
preconfigured SoPlexLegacy LP-solver.
Wrapper for several output streams. A verbosity level is used to decide which stream to use and wheth...
Definition: spxout.h:63
virtual SPxSolver::Status getPrimalray(Vector &vector) const
const T * get_const_ptr() const
get a const C pointer to the data.
Definition: dataarray.h:115
virtual bool writeState(const char *filename, const NameSet *rowNames=NULL, const NameSet *colNames=NULL, const bool cpxFormat=false) const
const VectorBase< R > & lhs() const
Returns left hand side vector.
Definition: spxlpbase.h:253
virtual bool writeBasisFile(const char *filename, const NameSet *rowNames, const NameSet *colNames)
virtual void getBasis(SPxSolver::VarStatus[], SPxSolver::VarStatus[], const int rowsSize=-1, const int colsSize=-1) const =0
get optimal basis.
variable set to its upper bound.
Definition: spxsolver.h:191
Basis descriptor.
Definition: spxbasis.h:104
virtual bool readBasisFile(const char *filename, const NameSet *rowNames, const NameSet *colNames)
virtual SPxSolver::Status getSlacks(Vector &vector) const
primal infeasibility was detected
Definition: spxsimplifier.h:84
const char * getRowName(int idx, const NameSet *rnames, char *buf)
Definition: soplexlegacy.h:289
bool m_freePostScaler
true iff m_postScaler should be freed inside of this object
Definition: soplexlegacy.h:55
virtual SPxSolver::Status status() const
returns the current status
Definition: soplexlegacy.h:359
virtual const Vector & unsimplifiedPrimal()=0
returns a reference to the unsimplified primal solution.
SPxSolver::VarStatus getBasisColStatus(int col) const
gets basis status for a single column.
virtual void loadLP(const SPxLP &LP, bool initSlackBasis=true)
copy LP.
Definition: spxsolver.cpp:68
virtual const char * getName() const
get name of ratio tester.
Preconfigured SoPlexLegacy LP-solver.
Definition: soplexlegacy.h:41
Real epsilon() const
values are considered to be 0.
Definition: spxsolver.h:758
virtual void loadBasis(const SPxBasis::Desc &)
set a start basis.
Definition: spxsolver.cpp:92
Set of strings.Class NameSet implements a symbol or name table. It allows to store or remove names (i...
Definition: nameset.h:61
virtual void scale(SPxLPBase< Real > &lp, bool persistent=true)=0
scale SPxLP.
Everything should be within this namespace.
bool isBasisValid(DataArray< VarStatus > rows, DataArray< VarStatus > cols)
check a given basis for validity.
Definition: spxsolver.cpp:1809
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:130
virtual Real objValue() const
primal unboundedness was detected
Definition: spxsimplifier.h:86
DataArray< SPxSolver::VarStatus > m_rowsbasisstatus
Definition: soplexlegacy.h:58
virtual void unsimplify(const Vector &, const Vector &, const Vector &, const Vector &, const SPxSolver::VarStatus[], const SPxSolver::VarStatus[], bool isOptimal=true)=0
reconstructs an optimal solution for the unsimplified LP.
SPxSolver m_solver
solver
Definition: soplexlegacy.h:50
const VectorBase< R > & maxObj() const
Returns objective vector for maximization problem.
Definition: spxlpbase.h:429
SPxScaler * m_postScaler
post-scaler
Definition: soplexlegacy.h:51
VarStatus getBasisRowStatus(int row) const
gets basis status for a single row
Definition: spxsolver.cpp:1778
variable is basic.
Definition: spxsolver.h:195
const SVectorBase< R > & rowVector(int i) const
Gets row vector of row i.
Definition: spxlpbase.h:204
VarStatus getBasisColStatus(int col) const
gets basis status for a single column
Definition: spxsolver.cpp:1784
virtual bool isUnsimplified() const
specifies whether an optimal solution has already been unsimplified.
LP scaler abstract base class.Instances of classes derived from SPxScaler may be loaded to SoPlex in ...
Definition: spxscaler.h:75
void unsimplify() const
undoes preprocessing such that the unsimplified solution values and basis is available ...
virtual const Vector & unsimplifiedDual()=0
returns a reference to the unsimplified dual solution.
virtual SPxSolver::Status getDual(Vector &vector) const
virtual SPxSolver::Status getDualfarkas(Vector &vector) const
int size() const
return nr. of elements.
Definition: dataarray.h:211
SLUFactor m_slu
LU Factorisation.
Definition: soplexlegacy.h:49
virtual SPxSolver::Status getRedCost(Vector &vector) const
virtual Status getRedCost(Vector &vector) const
get vector of reduced costs.
Definition: spxsolve.cpp:1642
bool m_freeSimplifier
true iff m_simplifier should be freed inside of this object
Definition: soplexlegacy.h:56
DataArray< SPxSolver::VarStatus > m_colsbasisstatus
Definition: soplexlegacy.h:57
SPxOut * spxout
Definition: spxlpbase.h:121
bool isConsistent() const
Consistency check.
Definition: spxlpbase.h:1810
SPxStatus
basis status.
Definition: spxbasis.h:90
int nCols() const
Returns number of columns in LP.
Definition: spxlpbase.h:157
Exception class for status exceptions during the computationsThis class is derived from the SoPlex ex...
Definition: exceptions.h:89
virtual const Vector & unsimplifiedRedCost()=0
returns a reference to the unsimplified reduced costs.
Real opttol() const
allowed optimality, i.e., dual feasibility tolerance.
Definition: spxsolver.h:785
virtual void unscaleSlacks(const SPxLPBase< Real > &lp, Vector &s) const
unscale dense slack vector given in s.
Definition: spxscaler.cpp:621
void setOutstream(SPxOut &newOutstream)
Definition: spxsolver.h:432
virtual void qualBoundViolation(Real &maxviol, Real &sumviol) const
get violations of bounds.
const SPxBasis & basis() const
Return current basis.
Definition: spxsolver.h:1727
virtual SPxSolver::Status solve()
virtual Status solve()
solve loaded LP.
Definition: spxsolve.cpp:73
LP has been proven to be primal unbounded.
Definition: spxbasis.h:98
const VectorBase< R > & lower() const
Returns (internal and possibly scaled) lower bound vector.
Definition: spxlpbase.h:483
const Desc & desc() const
Definition: spxbasis.h:463
columnwise representation.
Definition: spxsolver.h:108
void spx_free(T &p)
Release memory.
Definition: spxalloc.h:109
virtual void qualConstraintViolation(Real &maxviol, Real &sumviol) const
get violation of constraints.
virtual void setSimplifier(SPxSimplifier *simpli, const bool destroy=false)
setup simplifier to use. If destroy is true, simpli will be freed in destructor.
virtual Status getDual(Vector &vector) const
get current solution vector for dual variables.
Definition: spxsolve.cpp:1611
virtual Status getPrimalray(Vector &vector) const
get primal ray in case of unboundedness.
Definition: spxsolve.cpp:1685
Steepest edge pricer.Class SPxSteepPR implements a steepest edge pricer to be used with SoPlex...
Definition: spxsteeppr.h:41
LP has a usable Basis (maybe LP is changed).
Definition: spxsolver.h:217
virtual Status getSlacks(Vector &vector) const
get vector of slack variables.
Definition: spxsolve.cpp:1721
void setBasisStatus(SPxBasis::SPxStatus stat)
set the lp solver&#39;s basis status.
Definition: spxsolver.h:2016
LP has been proven to be primal unbounded.
Definition: spxsolver.h:221
LP has been proven to be primal infeasible.
Definition: spxbasis.h:99
No Problem has been loaded to the basis.
Definition: spxbasis.h:92