Skip to content

Commit

Permalink
Removed unused variables and added error messages to AMPLS?etOption f…
Browse files Browse the repository at this point in the history
…unctions.
  • Loading branch information
mapgccv committed May 30, 2023
1 parent 372c9c6 commit b15a483
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/solver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1255,34 +1255,44 @@ AMPLS_C_Option* AMPLSGetOptions(AMPLS_MP_Solver* slv) {
template <typename T> int AMPLSetOption(AMPLS_MP_Solver* slv,
const char* name, T v) {
auto be = AMPLSGetBackend(slv);
auto ii = ((AMPLS_MP__internal*)(slv->internal_info_));
try {
auto opt = be->GetOption(name);
opt->SetValue(v);
return 0;
}
catch (const mp::OptionError& ) {
catch (const mp::OptionError& o) {
((AMPLS_MP__internal*)(slv->internal_info_))->msg_extra_.
push_back(o.what());
return 1;
}
catch (const std::runtime_error& e) {
((AMPLS_MP__internal*)(slv->internal_info_))->msg_extra_.
push_back(e.what());
}
catch (const std::exception& ) {
return 2;
}
return 2;
}
template <typename T> int AMPLSGetOption(AMPLS_MP_Solver* slv,
const char* name, T v) {
auto be = AMPLSGetBackend(slv);
auto ii = ((AMPLS_MP__internal*)(slv->internal_info_));
try {
auto opt = be->GetOption(name);
opt->GetValue(*v);
return 0;
}
catch (const mp::OptionError& ) {
catch (const mp::OptionError& o) {
((AMPLS_MP__internal*)(slv->internal_info_))->msg_extra_.
push_back(o.what());
return 1;
}
catch (const std::exception& ) {
return 2;
catch (const std::runtime_error& e) {
((AMPLS_MP__internal*)(slv->internal_info_))->msg_extra_.
push_back(e.what());
}
catch (const std::exception&) {
}
return 2;
}
int AMPLSSetIntOption(AMPLS_MP_Solver* slv,
const char* name, int v) {
Expand Down Expand Up @@ -1320,5 +1330,4 @@ int AMPLSGetStrOption(AMPLS_MP_Solver* slv,
catch (const std::exception&) {
return 2;
}
//TODO
}

0 comments on commit b15a483

Please sign in to comment.