Skip to content

Commit

Permalink
Simplify sol check messages #200
Browse files Browse the repository at this point in the history
  • Loading branch information
glebbelov committed Nov 8, 2023
1 parent 73172d8 commit 0520ebf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
12 changes: 6 additions & 6 deletions doc/source/solution-check.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Running Gurobi with option ``feasrelax 1``, we trick MP
- 2 original variable(s) violate bounds,
up to 1E+05 (abs, item 'y'), up to 1E+00 (rel, item 'y')
Algebraic expression violations:
- 1 original expression(s) of type ':linrange',
- 1 linear constraint(s),
up to 2E+00 (abs, item 'C1'), up to 1E+00 (rel, item 'C1')
Objective value violations:
- 1 objective value(s) violated,
Expand Down Expand Up @@ -141,7 +141,7 @@ that the solver's reported solution violates checking tolerances.
[ sol:chk:feastol=1e-06, :feastolrel=1e-06, :inttol=1e-05,
:round='', :prec='' ]
Algebraic expression violations:
- 1 original expression(s) of type ':quadrange',
- 1 quadratic constraint(s),
up to 1E+00 (item 'socp[13]')
In this example, realistic check reports a constraint violation
Expand Down Expand Up @@ -219,10 +219,10 @@ use driver option ``chk:mode``:
[ sol:chk:feastol=1e-06, :feastolrel=1e-06, :inttol=1e-05,
:round='', :prec='' ]
Algebraic expression violations:
- 1 original expression(s) of type ':ifthen',
- 1 constraint(s) of type ':ifthen',
up to 1E+01 (abs)
Logical expression violations:
- 1 original expression(s) of type ':and'
- 1 constraint(s) of type ':and'
Objective value violations:
- 1 objective value(s) violated,
up to 1E+01 (abs)
Expand All @@ -245,10 +245,10 @@ set ``option (solver_)auxfiles rc;`` as follows:
[ sol:chk:feastol=1e-06, :feastolrel=1e-06, :inttol=1e-05,
:round='', :prec='' ]
Algebraic expression violations:
- 1 original expression(s) of type ':ifthen',
- 1 constraint(s) of type ':ifthen',
up to 1E+01 (abs, item 'Total_11_')
Logical expression violations:
- 1 original expression(s) of type ':and',
- 1 constraint(s) of type ':and',
(item 'Total_7_')
Objective value violations:
- 1 objective value(s) violated,
Expand Down
14 changes: 9 additions & 5 deletions include/mp/flat/sol_check.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,11 @@ class SolutionChecker {
chk.x_ext().solution_precision());
if (chk.HasAnyConViols()) {
Gen1Viol(chk.VarViolBnds().at(0), wrt, true,
" - {} original variable(s) violate bounds");
" - {} variable(s) violate bounds");
Gen1Viol(chk.VarViolBnds().at(1), wrt, true,
" - {} auxiliary variable(s) violate bounds");
Gen1Viol(chk.VarViolIntty().at(0), wrt, true,
" - {} original variable(s) violate integrality");
" - {} variable(s) violate integrality");
Gen1Viol(chk.VarViolIntty().at(1), wrt, true,
" - {} auxiliary variable(s) violate integrality");
}
Expand Down Expand Up @@ -268,13 +268,17 @@ class SolutionChecker {
wrt.write(classnm + " expression violations:\n");
for (const auto& cva: cvmap) {
Gen1Viol(cva.second.at(0), wrt, !alg_log,
" - {} original expression(s) of type '"
0==cva.first.compare(0, 4, ":lin")
? " - {} linear constraint(s)"
: 0==cva.first.compare(0, 5, ":quad")
? " - {} quadratic constraint(s)"
: " - {} constraint(s) of type '"
+ std::string(cva.first) + "'");
Gen1Viol(cva.second.at(1), wrt, !alg_log,
" - {} intermediate auxiliary expression(s) of type '"
" - {} intermediate auxiliary constraint(s) of type '"
+ std::string(cva.first) + "'");
Gen1Viol(cva.second.at(2), wrt, !alg_log,
" - {} final auxiliary expression(s) of type '"
" - {} final auxiliary constraint(s) of type '"
+ std::string(cva.first) + "'");
}
}
Expand Down

0 comments on commit 0520ebf

Please sign in to comment.