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_freePostScaler(false)
29  , m_freeSimplifier(false)
30 {
31  m_solver.setOutstream(outstream);
34  m_solver.setPricer(new SPxSteepPR(), true);
36 
38 }
39 
41 {
42  assert(!m_freePostScaler || m_postScaler != 0);
43  assert(!m_freeSimplifier || m_simplifier != 0);
44 
46  {
47  delete m_postScaler;
48  m_postScaler = 0;
49  }
50 
52  {
53  delete m_simplifier;
54  m_simplifier = 0;
55  }
56 }
57 
59 {
60  assert(!m_freePostScaler || m_postScaler != 0);
61  assert(!m_freeSimplifier || m_simplifier != 0);
62 
63  if(this != &base)
64  {
65  SPxLP::operator=(base);
66  m_slu = base.m_slu; // call of SLinSolver::clone() SPxBasis assignment operator not necessary (done by m_solver.setSolver(&m_slu) below)
67  m_solver = base.m_solver;
68  m_vanished = base.m_vanished;
70 
71  // m_postScaler
73  {
74  delete m_postScaler;
75  m_postScaler = 0;
76  }
77  if(base.m_postScaler == 0)
78  {
79  m_postScaler = 0;
80  m_freePostScaler = false;
81  }
82  else
83  {
85  m_freePostScaler = true;
86  }
87 
88  // m_simplifier
90  {
91  delete m_simplifier;
92  m_simplifier = 0;
93  }
94  if(base.m_simplifier == 0)
95  {
96  m_simplifier = 0;
97  m_freeSimplifier = false;
98  }
99  else
100  {
101  m_simplifier = base.m_simplifier->clone();
102  m_freeSimplifier = true;
103  }
104 
105 
106  }
107 
108  return *this;
109 }
110 
111 
113  : SPxLP(old)
114  , m_slu(old.m_slu) // call of SLinSolver::clone() SPxBasis copy constructor not necessary (done by m_solver.setSolver(&m_slu) below)
115  , m_solver(old.m_solver)
116  , m_vanished(old.m_vanished)
117 {
119 
120  // m_postScaler
121  if(old.m_postScaler == 0)
122  {
123  m_postScaler = 0;
124  m_freePostScaler = false;
125  }
126  else
127  {
129  m_freePostScaler = true;
130  }
131 
132  // m_simplifier
133  if(old.m_simplifier == 0)
134  {
135  m_simplifier = 0;
136  m_freeSimplifier = false;
137  }
138  else
139  {
141  m_freeSimplifier = true;
142  }
143 }
144 
145 
146 
147 void SoPlexLegacy::setPostScaler(SPxScaler* x, const bool destroy)
148 {
149 
150  assert(!m_freePostScaler || m_postScaler != 0);
151 
152  if(m_freePostScaler)
153  {
154  delete m_postScaler;
155  m_postScaler = 0;
156  }
157  m_postScaler = x;
158  if( m_postScaler )
160  m_freePostScaler = destroy;
161 }
162 
163 void SoPlexLegacy::setSimplifier(SPxSimplifier* x, const bool destroy)
164 {
165 
166  assert(!m_freeSimplifier || m_simplifier != 0);
167 
168  if(m_freeSimplifier)
169  {
170  delete m_simplifier;
171  m_simplifier = 0;
172  }
173  m_simplifier = x;
174  m_freeSimplifier = destroy;
175 }
176 
178 {
179 
180  DVector x(nCols());
181 
182  getPrimal(x);
183 
184  return x * maxObj() * Real(spxSense());
185 }
186 
188 {
189 
190  if (nRows() <= 0 && nCols() <= 0) // no problem loaded
191  throw SPxStatusException("XSOLVR01 No Problem loaded");
192 
193  // assume presolver did NOT solve problem
194  m_vanished = false;
195 
196  // working LP
197  SPxLP work(*this);
198  work.setOutstream(*spxout);
199 
200  // keep useful bounds for bfrt
201  bool keepbounds = (!strcmp(m_solver.ratiotester()->getName(), "Bound Flipping"));
202 
203  // should the LP be simplified ?
204  if (m_simplifier != 0)
205  {
206  switch(m_simplifier->simplify(work, m_solver.epsilon(), m_solver.feastol(), m_solver.opttol(), keepbounds))
207  {
210  return SPxSolver::UNBOUNDED;
213  return SPxSolver::INFEASIBLE;
215  m_vanished = true;
216  return SPxSolver::OPTIMAL;
217  case SPxSimplifier::OKAY:
218  break;
219  default:
220  throw SPxInternalCodeException("XRSOLVR01 This should never happen.");
221  }
222  }
223 
224  // should the LP be scaled after simplifing?
225  if (m_postScaler != 0)
226  m_postScaler->scale(work, false);
227 
228  /* if a basis of correct size was set externally, try to load it into the transformed LP */
229  if ( m_colsbasisstatus.size() == work.nCols() && m_rowsbasisstatus.size() == work.nRows() )
230  {
231  m_solver.loadLP(work);
233  {
235  }
238  }
239  /* if a basis with status at least REGULAR exists (loaded via readBasisFile()
240  * or available from previous simplex run), we check whether it can be (re)used
241  * for the newly loaded LP.
242  */
243  else if ( m_solver.basis().status() <= SPxBasis::SINGULAR )
244  {
245  m_solver.loadLP(work);
246  }
247  else
248  {
249  SPxBasis::Desc oldbasisdesc(m_solver.basis().desc());
250  m_solver.loadLP(work);
251  if(m_solver.basis().isDescValid(oldbasisdesc))
252  m_solver.loadBasis(oldbasisdesc);
253  }
254 
255  return m_solver.solve();
256 }
257 
259 {
260 
261  if (has_simplifier())
262  {
264  unsimplify();
265 
267 
268  if (m_vanished)
269  return SPxSolver::OPTIMAL;
270  else
271  return m_solver.status();
272  }
273 
274  // else
276 
277  // unscale postscaling
278  if (m_postScaler != 0)
280 
281  return stat;
282 }
283 
285 {
286 
287  if (has_simplifier())
288  {
290  unsimplify();
291 
293 
294  if (m_vanished)
295  return SPxSolver::OPTIMAL;
296  else
297  return m_solver.status();
298  }
299 
300  // else
302 
303  // unscale postscaling
304  if (m_postScaler != 0)
306 
307  return stat;
308 }
309 
311 {
312 
313  if (has_simplifier())
314  {
316  unsimplify();
317 
319 
320  if (m_vanished)
321  return SPxSolver::OPTIMAL;
322  else
323  return m_solver.status();
324  }
325 
326  // else
328 
329  // unscale postscaling
330  if (m_postScaler != 0)
332 
333  return stat;
334 }
335 
337 {
338 
339  if (has_simplifier())
340  {
342  unsimplify();
343 
344  rdcost = m_simplifier->unsimplifiedRedCost();
345 
346  if (m_vanished)
347  return SPxSolver::OPTIMAL;
348  else
349  return m_solver.status();
350  }
351 
352  // else
353  SPxSolver::Status stat = m_solver.getRedCost(rdcost);
354 
355  // unscale postscaling
356  if (m_postScaler != 0)
358 
359  return stat;
360 }
361 
363 {
365  if((b_status == SPxBasis::NO_PROBLEM || (has_simplifier() && b_status == SPxBasis::SINGULAR)) && !m_vanished)
366  return SPxSolver::UNDEFINED;
367 
368  if (has_simplifier())
369  {
371  unsimplify();
372 
373  return m_simplifier->getBasisRowStatus(i);
374  }
375  else
376  return m_solver.getBasisRowStatus(i);
377 }
378 
380 {
382  if((b_status == SPxBasis::NO_PROBLEM || (has_simplifier() && b_status == SPxBasis::SINGULAR)) && !m_vanished)
383  return SPxSolver::UNDEFINED;
384 
385  if (has_simplifier())
386  {
388  unsimplify();
389 
390  return m_simplifier->getBasisColStatus(j);
391  }
392  else
393  return m_solver.getBasisColStatus(j);
394 }
395 
397 {
399  if((b_status == SPxBasis::NO_PROBLEM || (has_simplifier() && b_status == SPxBasis::SINGULAR)) && !m_vanished)
400  {
401  int i;
402 
403  if (cols)
404  for (i = nCols() - 1; i >= 0; --i)
405  cols[i] = SPxSolver::UNDEFINED;
406 
407  if (rows)
408  for (i = nRows() - 1; i >= 0; --i)
409  rows[i] = SPxSolver::UNDEFINED;
410 
411  return m_solver.status();
412  }
413 
414  if (has_simplifier())
415  {
417  unsimplify();
418 
419  m_simplifier->getBasis(rows, cols);
420  return m_solver.status();
421  }
422 
423  else
424  return m_solver.getBasis(rows, cols);
425 }
426 
428 {
429  /// Does not work yet with presolve
430  if (has_simplifier())
431  {
432  MSG_ERROR( std::cerr << "ESOLVR02 Primal ray with presolving not yet implemented" << std::endl; )
433  throw SPxStatusException("XSOLVR02 Primal ray with presolving not yet implemented");
434  }
435  SPxSolver::Status stat = m_solver.getPrimalray(primalray);
436 
437  if (m_postScaler != 0)
438  m_postScaler->unscalePrimal(m_solver, primalray);
439 
440  return stat;
441 }
442 
444 {
445  /// Does not work yet with presolve
446  if (has_simplifier())
447  {
448  MSG_ERROR( std::cerr << "ESOLVR02 Dual farkas with presolving not yet implemented" << std::endl; )
449  throw SPxStatusException("XSOLVR03 Dual farkas with presolving not yet implemented");
450  // return SPxSolver::ERROR;
451  }
452  SPxSolver::Status stat = m_solver.getDualfarkas(dualfarkas);
453 
454  if (m_postScaler != 0)
455  m_postScaler->unscaleDual(m_solver, dualfarkas);
456 
457  return stat;
458 }
459 
461  Real& maxviol,
462  Real& sumviol) const
463 {
464  maxviol = 0.0;
465  sumviol = 0.0;
466 
467  DVector solu( nCols() );
468 
469  getPrimal( solu );
470 
471  for( int row = 0; row < nRows(); ++row )
472  {
473  const SVector& rowvec = rowVector( row );
474 
475  Real val = 0.0;
476 
477  for( int col = 0; col < rowvec.size(); ++col )
478  val += rowvec.value( col ) * solu[rowvec.index( col )];
479 
480  Real viol = 0.0;
481 
482  assert(lhs( row ) <= rhs( row ));
483 
484  if (val < lhs( row ))
485  viol = spxAbs(val - lhs( row ));
486  else
487  if (val > rhs( row ))
488  viol = spxAbs(val - rhs( row ));
489 
490  if (viol > maxviol)
491  maxviol = viol;
492 
493  sumviol += viol;
494  }
495 }
496 
498  Real& maxviol,
499  Real& sumviol) const
500 {
501  maxviol = 0.0;
502  sumviol = 0.0;
503 
504  DVector solu( nCols() );
505 
506  getPrimal( solu );
507 
508  for( int col = 0; col < nCols(); ++col )
509  {
510  assert( lower( col ) <= upper( col ));
511 
512  Real viol = 0.0;
513 
514  if (solu[col] < lower( col ))
515  viol = spxAbs( solu[col] - lower( col ));
516  else
517  if (solu[col] > upper( col ))
518  viol = spxAbs( solu[col] - upper( col ));
519 
520  if (viol > maxviol)
521  maxviol = viol;
522 
523  sumviol += viol;
524  }
525 }
526 
528  const char* filename,
529  const NameSet* rowNames,
530  const NameSet* colNames
531  )
532 {
533  // init solver using original LP
534  m_solver.loadLP(*this);
535  return m_solver.readBasisFile(filename, rowNames, colNames);
536 }
537 
539  const char* filename,
540  const NameSet* rowNames,
541  const NameSet* colNames
542  )
543 {
544  assert(rep() == SPxSolver::COLUMN);
545 
546  /* make sure the basis of the original problem is written */
547  unsimplify();
548 
549  std::ofstream file(filename);
550  std::ostream& os = file;
551 
552  os.setf(std::ios::left);
553  os << "NAME soplex.bas\n";
554 
555  /* do not write basis if there is none */
556  if( status() == SPxSolver::NO_PROBLEM )
557  {
558  os << "ENDATA" << std::endl;
559  return true;
560  }
561 
562  /* start writing */
563  char buf[SPX_MAXSTRLEN];
564  int row = 0;
565  for( int col = 0; col < nCols(); col++ )
566  {
567  if( getBasisColStatus(col) == SPxSolver::BASIC )
568  {
569  /* Find non basic row */
570  for( ; row < nRows(); row++ )
571  {
572  if( getBasisRowStatus(row) != SPxSolver::BASIC )
573  break;
574  }
575 
576  assert(row != nRows());
577 
578  os << ( getBasisRowStatus(row) == SPxSolver::ON_UPPER ? " XU " : " XL " )
579  << std::setw(8) << getColName(col, colNames, buf);
580 
581  /* break in two parts since buf is reused */
582  os << " "
583  << getRowName(row, rowNames, buf)
584  << std::endl;
585 
586  row++;
587  }
588  else
589  {
591  {
592  os << " UL "
593  << getColName(col, colNames, buf)
594  << std::endl;
595  }
596  }
597  }
598 
599  #ifndef NDEBUG
600  // Check that we covered all nonbasic rows - the remaining should be basic.
601  for( ; row < nRows(); row++ )
602  {
603  if( getBasisRowStatus(row) != SPxSolver::BASIC )
604  break;
605  }
606  assert(row == nRows());
607  #endif // NDEBUG
608 
609  os << "ENDATA" << std::endl;
610  return true;
611 }
612 
614  const char* filename,
615  const NameSet* rowNames,
616  const NameSet* colNames ) const
617 {
618 
619  return m_solver.writeState(filename, rowNames, colNames);
620 }
621 
623 {
625  return;
626 
627  DVector psp_x(m_solver.nCols()); // primal solution (prescaled simplified postscaled)
628  DVector psp_y(m_solver.nRows()); // dual solution (prescaled simplified postscaled)
629  DVector psp_s(m_solver.nRows()); // slacks (prescaled simplified postscaled)
630  DVector psp_r(m_solver.nCols()); // reduced costs (prescaled simplified postscaled)
631 
632  if (! m_vanished) {
633  // If solver status is not regular or optimal, do nothing.
634  const SPxSolver::Status stat = status();
635  if( stat != SPxSolver::OPTIMAL && stat != SPxSolver::REGULAR )
636  return;
637 
638  m_solver.getPrimal(psp_x);
639  m_solver.getDual(psp_y);
640  m_solver.getSlacks(psp_s);
641  m_solver.getRedCost(psp_r);
642 
643  // unscale postscaling
644  if (m_postScaler != 0)
645  {
650  }
651  }
652  else {
653  // If there is no sensible solution, do nothing.
654  const SPxSolver::Status stat = status();
655  if (stat != SPxSolver::OPTIMAL)
656  return;
657 
658  psp_x.reDim(0);
659  psp_y.reDim(0);
660  psp_s.reDim(0);
661  psp_r.reDim(0);
662  }
663 
664  // unsimplify
665  if(m_vanished)
666  {
667  m_simplifier->unsimplify(psp_x, psp_y, psp_s, psp_r, NULL, NULL);
668  }
669  else
670  {
671  SPxSolver::VarStatus *rows, *cols;
672  rows = NULL;
673  cols = NULL;
674  try
675  {
676  spx_alloc(rows, m_solver.nRows());
677  spx_alloc(cols, m_solver.nCols());
678 
679  m_solver.getBasis(rows, cols, m_solver.nRows(), m_solver.nCols());
680  m_simplifier->unsimplify(psp_x, psp_y, psp_s, psp_r, rows, cols);
681  }
682  catch( const SPxMemoryException& x)
683  {
684  spx_free(rows);
685  spx_free(cols);
686  throw x;
687  }
688 
689  spx_free(rows);
690  spx_free(cols);
691  }
692 }
693 } // 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:606
SPxBasis::SPxStatus getBasisStatus() const
gets basis status
Definition: spxsolver.h:2013
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:1593
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:1756
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:1873
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:1800
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:786
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:642
virtual void unscaleDual(const SPxLPBase< Real > &lp, Vector &pi) const
unscale dense dual solution vector given in pi.
Definition: spxscaler.cpp:630
SPxLPBase< Real > & operator=(const SPxLPBase< Real > &old)
Assignment operator.
Definition: spxlpbase.h:2629
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:252
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:112
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:1734
virtual void setOutstream(SPxOut &newOutstream)
set message handler
Definition: spxscaler.h:138
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:131
double Real
Definition: spxdefines.h:218
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:1910
const char * getColName(int idx, const NameSet *cnames, char *buf)
Definition: soplexlegacy.h:267
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:234
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:114
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:288
bool m_freePostScaler
true iff m_postScaler should be freed inside of this object
Definition: soplexlegacy.h:54
virtual SPxSolver::Status status() const
returns the current status
Definition: soplexlegacy.h:358
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:767
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:1819
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:57
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:1788
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:1794
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:76
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:1673
bool m_freeSimplifier
true iff m_simplifier should be freed inside of this object
Definition: soplexlegacy.h:55
DataArray< SPxSolver::VarStatus > m_colsbasisstatus
Definition: soplexlegacy.h:56
SPxOut * spxout
Definition: spxlpbase.h:121
bool isConsistent() const
Consistency check.
Definition: spxlpbase.h:1841
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:794
virtual void unscaleSlacks(const SPxLPBase< Real > &lp, Vector &s) const
unscale dense slack vector given in s.
Definition: spxscaler.cpp:618
void setOutstream(SPxOut &newOutstream)
Definition: spxsolver.h:441
virtual void qualBoundViolation(Real &maxviol, Real &sumviol) const
get violations of bounds.
const SPxBasis & basis() const
Return current basis.
Definition: spxsolver.h:1736
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:1642
virtual Status getPrimalray(Vector &vector) const
get primal ray in case of unboundedness.
Definition: spxsolve.cpp:1716
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:1752
void setBasisStatus(SPxBasis::SPxStatus stat)
set the lp solver&#39;s basis status.
Definition: spxsolver.h:2025
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
#define SPX_MAXSTRLEN
Definition: spxdefines.h:249