9#ifndef FMTsolve_H_INCLUDED
10#define FMTsolve_H_INCLUDED
16#include <unordered_map>
17#include <boost/serialization/split_member.hpp>
18#include <boost/serialization/export.hpp>
19#include <boost/archive/binary_oarchive.hpp>
20#include <boost/archive/binary_iarchive.hpp>
24class OsiSolverInterface;
25class CoinPackedMatrix;
40 friend class boost::serialization::access;
45 template<
class Archive>
46 void save(Archive& ar,
const unsigned int version)
const
49 ar& boost::serialization::make_nvp(
"FMTobject", boost::serialization::base_object<Core::FMTobject>(*
this));
50 ar& BOOST_SERIALIZATION_NVP(usecache);
51 matrixcache.synchronize(solverinterface);
53 ar& BOOST_SERIALIZATION_NVP(solvertype);
54 ar& BOOST_SERIALIZATION_NVP(matrix);
58 _exhandler->raisefromcatch(
"",
"FMTlpsolver::save", __LINE__, __FILE__);
65 template<
class Archive>
66 void load(Archive& ar,
const unsigned int version)
69 ar& boost::serialization::make_nvp(
"FMTobject", boost::serialization::base_object<FMTobject>(*
this));
70 ar& BOOST_SERIALIZATION_NVP(usecache);
71 matrixcache.synchronize(solverinterface);
72 FMTserializablematrix matrix;
73 ar& BOOST_SERIALIZATION_NVP(solvertype);
74 ar& BOOST_SERIALIZATION_NVP(matrix);
75 solverinterface = this->buildsolverinterface(solvertype);
76 matrix.setmatrix(solverinterface);
80 _exhandler->raisefromcatch(
"",
"FMTlpsolver::load", __LINE__, __FILE__);
84 BOOST_SERIALIZATION_SPLIT_MEMBER()
87 std::shared_ptr<OsiSolverInterface>solverinterface;
102 bool canupdatesource() const;
107 std::shared_ptr<OsiSolverInterface> buildsolverinterface(const
FMTsolverinterface& lsolvertype) const;
112 std::shared_ptr<OsiSolverInterface> copysolverinterface(const std::shared_ptr<OsiSolverInterface>& solver_ptr, const
FMTsolverinterface& lsolvertype) const;
117 void clearrowcache();
122 const CoinPackedMatrix* getMatrixByRow() const;
127 const CoinPackedMatrix* getMatrixByCol() const;
138 void passinlogger(const std::shared_ptr<
Logging::FMTlogger>& logger) override;
143 void unmarkHotStart();
200 virtual
bool resolve();
208 virtual
bool initialsolve();
214 void setnumberofthreads(const
size_t& nthread);
221 void setMIPgaptolerance(const
double& gap);
226 void setoptimizerMAXtime(const
double& time);
231 void MIPparameters();
236 double getObjValue() const;
241 int getiterationcount() const;
251 void passinmessagehandler(
Logging::FMTlogger& logger);
261 bool gotlicense() const;
266 std::
string getsolvername() const;
271 int getNumCols() const;
276 int getNumRows() const;
282 const
double* getObjCoefficients() const;
288 const
double* getColLower() const;
294 const
double* getColUpper() const;
299 const
double* getColSolution() const;
304 const
double* getRowPrice() const;
309 const
double* getRowActivity() const;
315 const
double* getRowUpper() const;
321 const
double* getRowLower() const;
328 int getrow(
int whichRow,
double &rowLower,
double &rowUpper,
329 std::vector<
int>& indices, std::vector<
double>&elements) const;
336 int getcol(
int whichCol,
double &colLower,
double &colUpper,
double &objectiveValue,
337 std::vector<
int>& indices, std::vector<
double>&elements) const;
343 double getObjSense() const;
348 void setObjective(const
double* objectivevalues);
353 void setObjSense(const
double& newsense);
360 void addRow(
int numberInRow, const
int * columns, const
double * elements,
361 double rowLower = -std::numeric_limits<
double>::max(),
double rowUpper = std::numeric_limits<
double>::max());
368 void addCol(
int numberInColumn, const
int * rows, const
double * elements,
double columnLower = 0.0,
369 double columnUpper = std::numeric_limits<
double>::max(),
double objectiveValue = 0.0);
374 void addRows(const
int numrows, const
int* rowStarts, const
int* columns,
375 const
double* elements, const
double* rowlb, const
double* rowub);
380 void addCols(const
int numcols, const
int* columnStarts, const
int* rows,
381 const
double* elements, const
double* collb, const
double* colub, const
double* obj);
386 bool isProvenOptimal() const;
391 void deleteRow(const
int& rowindex);
396 void deleteCol(const
int& colindex);
401 void deleteRows(
int numberofrows,const
int* rowindexes);
406 void deleteCols(
int numberofcols, const
int* colindexes);
412 void setColSolution(const
double* newsolution);
418 void setRowPrice(const
double* rowprice);
424 void setColSetBounds(const
int* indexFirst, const
int* indexLast, const
double* boundlist);
430 void setRowSetBounds(const
int* indexFirst, const
int* indexLast, const
double* boundlist);
436 void setInteger(const
int& colindex);
442 void setInteger(const
int* indices,
int len);
453 void setcolname(const std::
string& name, const
int& columnid) const;
458 void setrowname(const std::
string& name, const
int& rowid) const;
463 void writeLP(const std::
string& location) const;
468 void writeMPS(const std::
string& location) const;
473 void branchAndBound();
479 void enablematrixcaching();
485 void disablematrixcaching();
511 return matrixcache.getdeletedconstraints();
519 return matrixcache.getdeletedvariables();
#define FMTEXPORT
Definition: FMTutility.hpp:92
Definition: FMTobject.hpp:50
Definition: FMTlpsolver.hpp:39
const std::vector< int > & getcachedeletedvariables() const
Definition: FMTlpsolver.hpp:517
void updaterowsandcolsnames(bool shortformat=true)
std::string getcacheelements() const
const std::vector< int > & getcachedeletedconstraints() const
Definition: FMTlpsolver.hpp:509
std::string lowernuppertostr(const double &lower, const double &upper) const
std::string getmskerrordesc(int error) const
Definition: FMTmatrixbuild.hpp:34
Definition: FMTserializablematrix.hpp:32
Namespace for the log management, provides different log handlers.
Definition: FMTdebuglogger.hpp:14
Namespace containing all enumerator and classes used to construct or manipulate the different type of...
Definition: FMTareaparser.hpp:50
FMTsolverinterface
Definition: FMTsolverinterface.hpp:21
void load(Ar &ar, dynamic_bitset< Block, Alloc > &bs, unsigned)
Definition: FMTmask.hpp:48