Commit 54f737cf authored by Martin Marinov's avatar Martin Marinov
Browse files

Removed Cbc dependencies and related symbols in DOCloudSover.cc

[git-p4: depot-paths = "//ReForm/ReForm/main/CoMISo/": change = 12100]
parent 34d1f205
...@@ -20,10 +20,6 @@ ...@@ -20,10 +20,6 @@
#include <Base/Debug/DebUtils.hh> #include <Base/Debug/DebUtils.hh>
#include <Base/Utils/OutcomeUtils.hh> #include <Base/Utils/OutcomeUtils.hh>
// Cbc includes, we use them to construct the problem .mps file
#include <CoinPackedVector.hpp>
#include <OsiClpSolverInterface.hpp>
#include <curl/curl.h> #include <curl/curl.h>
#include <boost/property_tree/ptree.hpp> #include <boost/property_tree/ptree.hpp>
...@@ -46,8 +42,6 @@ DEB_module("DOCloudSolver") ...@@ -46,8 +42,6 @@ DEB_module("DOCloudSolver")
namespace COMISO { namespace COMISO {
//== IMPLEMENTATION ========================================================== //== IMPLEMENTATION ==========================================================
#define TRACE_CBT(DESCR, EXPR) DEB_line(7, DESCR << ": " << EXPR)
#define P(X) ((X).data())
namespace { namespace {
...@@ -735,9 +729,6 @@ void Job::solution(std::vector<double>& _x) const ...@@ -735,9 +729,6 @@ void Job::solution(std::vector<double>& _x) const
} // namespace DOcloud } // namespace DOcloud
namespace {
std::string lp_file_name() std::string lp_file_name()
{ {
// TODO: This is not MT-safe, it's not even process-safe! // TODO: This is not MT-safe, it's not even process-safe!
...@@ -747,6 +738,7 @@ std::string lp_file_name() ...@@ -747,6 +738,7 @@ std::string lp_file_name()
return filename + ".lp"; return filename + ".lp";
} }
#define P(X) ((X).data())
#define XVAR(IDX) "x" << IDX #define XVAR(IDX) "x" << IDX
class WriteExpression class WriteExpression
...@@ -916,17 +908,21 @@ std::string create_lp_file( ...@@ -916,17 +908,21 @@ std::string create_lp_file(
return f_name; return f_name;
} }
#undef XVAR // don't propagate macros otside of scope #undef XVAR
} // namespace
}// namespace
void DOCloudSolver::set_api_key(const char* _api_key)
{
DOcloud::api_key__ = std::string("X-IBM-Client-Id: ") + _api_key;
}
void solve_impl( void DOCloudSolver::solve(
NProblemInterface* _problem, NProblemInterface* _problem,
const std::vector<NConstraintInterface*>& _constraints, const std::vector<NConstraintInterface*>& _constraints,
const std::vector<PairIndexVtype>& _discrete_constraints, const std::vector<PairIndexVtype>& _discrete_constraints,
const double /*_time_limit*/ const double _time_limit
) )
{ {
DEB_enter_func; DEB_enter_func;
...@@ -947,37 +943,8 @@ void solve_impl( ...@@ -947,37 +943,8 @@ void solve_impl(
_problem->store_result(P(x)); _problem->store_result(P(x));
} }
}// namespace
#undef CBC_INFINITY
#undef TRACE_CBT
#undef P #undef P
void DOCloudSolver::set_api_key(const char* _api_key)
{
DOcloud::api_key__ = std::string("X-IBM-Client-Id: ") + _api_key;
}
void DOCloudSolver::solve(
NProblemInterface* _problem,
const std::vector<NConstraintInterface*>& _constraints,
const std::vector<PairIndexVtype>& _discrete_constraints,
const double _time_limit
)
{
DEB_enter_func;
try
{
solve_impl(_problem, _constraints, _discrete_constraints, _time_limit);
}
catch (CoinError& ce)
{
DEB_warning(1, "CoinError code = " << ce.message() << "]\n");
THROW_OUTCOME(TODO);
}
}
//============================================================================= //=============================================================================
} // namespace COMISO } // namespace COMISO
//============================================================================= //=============================================================================
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment