Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:ampl/mp into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
mapgccv committed Aug 26, 2024
2 parents 97ee577 + e38ae6f commit d76f85b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 2 additions & 0 deletions include/mp/backend-with-mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class BackendWithModelManager
HandleSolution(solve_result, // prints if no -AMPL flag
GetWarnings() + msg.c_str(),
0, 0, 0.0);
if (!ampl_flag())
std::exit(EXIT_FAILURE);
}


Expand Down
7 changes: 4 additions & 3 deletions include/mp/flat/constr_2_expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,9 @@ class Constraints2Expr {

bool HasExpressionArgs(const LinTerms& lt) const {
for (auto v: lt.vars())
if (!MPCD( IsProperVar(v) ))
if (!MPCD( IsProperVar(v) )) {
return true;
}
return false;
}

Expand Down Expand Up @@ -415,9 +416,9 @@ class Constraints2Expr {
result.reserve(ltin.size() - nvars);
int v=0;
for (size_t i=0; i<ltin.size(); ++i) {
if (MPCD( IsProperVar(v = ltin.var(i)) ))
if (MPCD( IsProperVar(v = ltin.var(i)) )) {
lt_out_vars.add_term(ltin.coef(i), v);
else
} else
result.add_term(ltin.coef(i), v);
}
return result;
Expand Down
7 changes: 5 additions & 2 deletions include/mp/flat/constr_keeper.h
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,10 @@ class ConstraintKeeper final
}

void DoCvtWithExprs() {
auto cal = GetChosenAcceptanceLevel();
// For acc:_all=0 to work, we have to accept non-convertible con types
auto cal = IfConverterConverts(GetConverter())
? GetChosenAcceptanceLevel()
: ConstraintAcceptanceLevel::Recommended;
auto eal = GetChosenAcceptanceLevelEXPR();
ForEachActive(
[this, cal, eal](const auto& con, int i) {
Expand All @@ -390,7 +393,7 @@ class ConstraintKeeper final
/// Call Converter's RunConversion() and mark as "bridged".
///
/// @param cnt the constraint container -
/// actually redundant, as \a i is enough to find it. But for speed.
/// actually redundant, as \a i is enough to find it. But for speed.
/// @param i constraint index, needed for bridging
void ConvertConstraint(Container& cnt, int i) {
assert(!cnt.IsBridged());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ subj to c2: y <= x + 1;
subj to c3: y <= 2*x;
subj to c4: y >= 2*x - 2;

option solver gurobi;
# option solver gurobi;
solve xobj;
# display x, y;

Expand Down

0 comments on commit d76f85b

Please sign in to comment.