00001
00002
00003
00004 #include "CoinHelperFunctions.hpp"
00005 #include "OsiSolverInterface.hpp"
00006 #include "BCP_lp_result.hpp"
00007
00008 void
00009 BCP_lp_result::get_results(OsiSolverInterface& lp)
00010 {
00011 lp.getDblParam(OsiPrimalTolerance, _primal_tolerance);
00012 lp.getDblParam(OsiDualTolerance, _dual_tolerance);
00013 lp.getStrParam(OsiSolverName, _solvername);
00014 delete[] _x;
00015 delete[] _pi;
00016 delete[] _dj;
00017 delete[] _lhs;
00018 _x = 0;
00019 _pi = 0;
00020 _dj = 0;
00021 _lhs = 0;
00022
00023 _termcode = 0;
00024 _termcode |= (lp.isAbandoned() ? BCP_Abandoned : 0);
00025 _termcode |= (lp.isProvenOptimal() ? BCP_ProvenOptimal : 0);
00026 _termcode |= (lp.isProvenPrimalInfeasible() ? BCP_ProvenPrimalInf : 0);
00027 _termcode |= (lp.isProvenDualInfeasible() ? BCP_ProvenDualInf : 0);
00028 if (_solvername != "Ipopt") {
00029 _termcode |= (lp.isPrimalObjectiveLimitReached() ? BCP_PrimalObjLimReached : 0);
00030 }
00031 _termcode |= (lp.isDualObjectiveLimitReached() ? BCP_DualObjLimReached : 0);
00032 _termcode |= (lp.isIterationLimitReached() ? BCP_IterationLimit : 0);
00033
00034 if ((_termcode & BCP_Abandoned) == 0) {
00035 _iternum = lp.getIterationCount();
00036 _objval = lp.getObjValue();
00037
00038 const int colnum = lp.getNumCols();
00039 _x = new double[colnum];
00040 CoinDisjointCopyN(lp.getColSolution(), colnum, _x);
00041
00042 if (_solvername == "Ipopt") {
00043 _dj = NULL;
00044 } else {
00045 _dj = new double[colnum];
00046 CoinDisjointCopyN(lp.getReducedCost(), colnum, _dj);
00047 }
00048
00049 const int rownum = lp.getNumRows();
00050 _pi = new double[rownum];
00051 CoinDisjointCopyN(lp.getRowPrice(), rownum, _pi);
00052 _lhs = new double[rownum];
00053 CoinDisjointCopyN(lp.getRowActivity(), rownum, _lhs);
00054 }
00055 }