Commit e86dce00 authored by Martin Marinov's avatar Martin Marinov
Browse files

Added Config::DOCloud

[git-p4: depot-paths = "//ReForm/ReForm/main/CoMISo/": change = 12201]
parent bdf6ed30
......@@ -48,6 +48,31 @@ Config& Config::object()
return config;
}
void Config::set_root_url(const char* const _root_url)
{
root_url_ = _root_url;
}
void Config::set_api_key(const char* _api_key)
{
api_key_ = std::string("X-IBM-Client-Id: ") + _api_key;
}
void Config::set_infeasible_timeout(const int _infs_time)
{
infs_time_ = _infs_time;
}
void Config::set_feasible_timeout(const int _fsbl_time)
{
fsbl_time_ = _fsbl_time;
}
void Config::set_cache_location(const char* const _cache_loc)
{
cache_loc_ = _cache_loc;
}
//////////////////////////////////////////////////////////////////////////
// Config
const Config& Config::query() { return object(); }
......@@ -416,6 +441,14 @@ bool Job::active() const
*/
}
bool Job::stalled() const
{
// exit quick if we have a solution, or wait if we don't have one
const auto& config = Config::query();
return (sol_nmbr_ > 0 && stld_sec_nmbr_ >= config.feasible_timeout())
|| (sol_nmbr_ == 0 && stld_sec_nmbr_ >= config.infeasible_timeout());
}
void Job::abort()
{
std::string exct_stts;
......
......@@ -41,12 +41,7 @@ public:
void sync_status();
void sync_log();
bool active() const; // requires synchronized status
bool stalled() const
{
// exit quick if we have a solution, or wait 5 min if we don't have one
return (sol_nmbr_ > 0 && stld_sec_nmbr_ >= 15) ||
(sol_nmbr_ == 0 && stld_sec_nmbr_ >= 300);
}
bool stalled() const;
void abort();
double solution(std::vector<double>& _x) const;
......
......@@ -259,11 +259,6 @@ std::string create_lp_string(
} // namespace DOcloud
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,
......
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