00001
00002
00003 #ifndef _BCP_LP_RESULT_H
00004 #define _BCP_LP_RESULT_H
00005
00006
00007
00008 #include <cfloat>
00009 #include <string>
00010
00011 #include "BCP_math.hpp"
00012 #include "BCP_error.hpp"
00013 #include "BCP_vector.hpp"
00014 #include "OsiSolverInterface.hpp"
00015
00017 enum BCP_termcode {
00019 BCP_Abandoned = 0x01,
00021 BCP_ProvenOptimal = 0x02,
00023 BCP_ProvenPrimalInf = 0x04,
00025 BCP_ProvenDualInf = 0x08,
00027 BCP_PrimalObjLimReached = 0x10,
00029 BCP_DualObjLimReached = 0x20,
00031 BCP_IterationLimit = 0x40,
00033 BCP_TimeLimit = 0x80
00034 };
00035
00039 class BCP_lp_result {
00040 private:
00044 BCP_lp_result(const BCP_lp_result&);
00046 BCP_lp_result& operator=(const BCP_lp_result&);
00049 private:
00053 std::string _solvername;
00054 double _lower_bound;
00056 double _primal_tolerance;
00058 double _dual_tolerance;
00064 int _termcode;
00067 int _iternum;
00071 double _objval;
00073 double* _x;
00075 double* _pi;
00077 double* _dj;
00079 double* _lhs;
00082 public:
00087 BCP_lp_result() :
00088 _solvername(),
00089 _lower_bound(-BCP_DBL_MAX), _primal_tolerance(0), _dual_tolerance(0),
00090 _termcode(BCP_ProvenOptimal), _iternum(0), _objval(0),
00091 _x(0), _pi(0), _dj(0), _lhs(0)
00092 {}
00094 ~BCP_lp_result() {
00095 delete[] _x;
00096 delete[] _pi;
00097 delete[] _dj;
00098 delete[] _lhs;
00099 }
00102
00108 const std::string& solvername() const { return _solvername; }
00110
00111 int termcode() const { return _termcode; }
00113
00114 int iternum() const { return _iternum; }
00116
00117 double objval() const { return _objval; }
00119
00120 const double* x() const { return _x; }
00122
00123 const double* pi() const { return _pi; }
00125
00126 const double* dj() const { return _dj; }
00128
00129 const double* lhs() const { return _lhs; }
00135 double primalTolerance() const { return _primal_tolerance; }
00137 double dualTolerance() const { return _dual_tolerance; }
00145 void get_results(OsiSolverInterface& lp_solver);
00148 void fake_objective_value(const double val) {
00149 _objval = val;
00150 }
00152 };
00153
00154 #endif