From 0520ebf8e2cd9fe874af56655e5ceda11e069421 Mon Sep 17 00:00:00 2001 From: Gleb Belov Date: Wed, 8 Nov 2023 11:41:29 +1100 Subject: [PATCH] Simplify sol check messages #200 --- doc/source/solution-check.rst | 12 ++++++------ include/mp/flat/sol_check.h | 14 +++++++++----- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/doc/source/solution-check.rst b/doc/source/solution-check.rst index 6e1f7eca1..52b3b46c3 100644 --- a/doc/source/solution-check.rst +++ b/doc/source/solution-check.rst @@ -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, @@ -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 @@ -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) @@ -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, diff --git a/include/mp/flat/sol_check.h b/include/mp/flat/sol_check.h index 3448fe490..efce3dff0 100644 --- a/include/mp/flat/sol_check.h +++ b/include/mp/flat/sol_check.h @@ -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"); } @@ -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) + "'"); } }