MCPcopy Create free account
hub / github.com/ERGO-Code/HiGHS / analyseModelBounds

Function analyseModelBounds

highs/lp_data/HighsModelUtils.cpp:23–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21#include "util/stringutil.h"
22
23void analyseModelBounds(const HighsLogOptions& log_options, const char* message,
24 HighsInt numBd, const std::vector<double>& lower,
25 const std::vector<double>& upper) {
26 if (numBd == 0) return;
27 HighsInt numFr = 0;
28 HighsInt numLb = 0;
29 HighsInt numUb = 0;
30 HighsInt numBx = 0;
31 HighsInt numFx = 0;
32 for (HighsInt ix = 0; ix < numBd; ix++) {
33 if (highs_isInfinity(-lower[ix])) {
34 // Infinite lower bound
35 if (highs_isInfinity(upper[ix])) {
36 // Infinite lower bound and infinite upper bound: Fr
37 numFr++;
38 } else {
39 // Infinite lower bound and finite upper bound: Ub
40 numUb++;
41 }
42 } else {
43 // Finite lower bound
44 if (highs_isInfinity(upper[ix])) {
45 // Finite lower bound and infinite upper bound: Lb
46 numLb++;
47 } else {
48 // Finite lower bound and finite upper bound:
49 if (lower[ix] < upper[ix]) {
50 // Distinct finite bounds: Bx
51 numBx++;
52 } else {
53 // Equal finite bounds: Fx
54 numFx++;
55 }
56 }
57 }
58 }
59 highsLogDev(log_options, HighsLogType::kInfo,
60 "Analysing %" HIGHSINT_FORMAT " %s bounds\n", numBd, message);
61 if (numFr > 0)
62 highsLogDev(log_options, HighsLogType::kInfo,
63 " Free: %7" HIGHSINT_FORMAT " (%3" HIGHSINT_FORMAT "%%)\n",
64 numFr, (100 * numFr) / numBd);
65 if (numLb > 0)
66 highsLogDev(log_options, HighsLogType::kInfo,
67 " LB: %7" HIGHSINT_FORMAT " (%3" HIGHSINT_FORMAT "%%)\n",
68 numLb, (100 * numLb) / numBd);
69 if (numUb > 0)
70 highsLogDev(log_options, HighsLogType::kInfo,
71 " UB: %7" HIGHSINT_FORMAT " (%3" HIGHSINT_FORMAT "%%)\n",
72 numUb, (100 * numUb) / numBd);
73 if (numBx > 0)
74 highsLogDev(log_options, HighsLogType::kInfo,
75 " Boxed: %7" HIGHSINT_FORMAT " (%3" HIGHSINT_FORMAT "%%)\n",
76 numBx, (100 * numBx) / numBd);
77 if (numFx > 0)
78 highsLogDev(log_options, HighsLogType::kInfo,
79 " Fixed: %7" HIGHSINT_FORMAT " (%3" HIGHSINT_FORMAT "%%)\n",
80 numFx, (100 * numFx) / numBd);

Callers 1

analyseLpFunction · 0.85

Calls 2

highs_isInfinityFunction · 0.85
highsLogDevFunction · 0.85

Tested by

no test coverage detected