1 /* $Id: CoinMessage.cpp 2083 2019-01-06 19:38:09Z unxusr $ */
2 // Copyright (C) 2002, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 // This code is licensed under the terms of the Eclipse Public License (EPL).
5
6 #if defined(_MSC_VER)
7 // Turn off compiler warning about long names
8 #pragma warning(disable : 4786)
9 #endif
10
11 #include "CoinPragma.hpp"
12 #include "CoinMessage.hpp"
13 #include "CoinError.hpp"
14
15 typedef struct {
16 COIN_Message internalNumber;
17 int externalNumber; // or continuation
18 char detail;
19 const char *message;
20 } Coin_message;
21 static Coin_message us_english[] = {
22 { COIN_MPS_LINE, 1, 1, "At line %d %s" },
23 { COIN_MPS_STATS, 2, 1, "Problem %s has %d rows, %d columns and %d elements" },
24 { COIN_MPS_ILLEGAL, 3001, 0, "Illegal value for %s of %g" },
25 { COIN_MPS_BADIMAGE, 3002, 0, "Bad image at line %d < %s >" },
26 { COIN_MPS_DUPOBJ, 3003, 0, "Duplicate objective at line %d < %s >" },
27 { COIN_MPS_DUPROW, 3004, 0, "Duplicate row %s at line %d < %s >" },
28 { COIN_MPS_NOMATCHROW, 3005, 0, "No match for row %s at line %d < %s >" },
29 { COIN_MPS_NOMATCHCOL, 3006, 0, "No match for column %s at line %d < %s >" },
30 { COIN_MPS_FILE, 6001, 0, "Unable to open mps input file %s" },
31 { COIN_MPS_BADFILE1, 6002, 0, "Unknown image %s at line %d of file %s" },
32 { COIN_MPS_BADFILE2, 6003, 0, "Consider the possibility of a compressed file\
33 which %s is unable to read" },
34 { COIN_MPS_EOF, 6004, 0, "EOF on file %s" },
35 { COIN_MPS_RETURNING, 6005, 0, "Returning as too many errors" },
36 { COIN_MPS_CHANGED, 3008, 1, "Generated %s names had duplicates - %d changed" },
37 { COIN_SOLVER_MPS, 8, 1, "%s read with %d errors" },
38 { COIN_PRESOLVE_COLINFEAS, 501, 2, "Problem is infeasible due to column %d, %.16g %.16g" },
39 { COIN_PRESOLVE_ROWINFEAS, 502, 2, "Problem is infeasible due to row %d, %.16g %.16g" },
40 { COIN_PRESOLVE_COLUMNBOUNDA, 503, 2, "Problem looks unbounded above due to column %d, %g %g" },
41 { COIN_PRESOLVE_COLUMNBOUNDB, 504, 2, "Problem looks unbounded below due to column %d, %g %g" },
42 { COIN_PRESOLVE_NONOPTIMAL, 505, 1, "Presolved problem not optimal, resolve after postsolve" },
43 { COIN_PRESOLVE_STATS, 506, 1, "Presolve %d (%d) rows, %d (%d) columns and %d (%d) elements" },
44 { COIN_PRESOLVE_INFEAS, 507, 1, "Presolve determined that the problem was infeasible with tolerance of %g" },
45 { COIN_PRESOLVE_UNBOUND, 508, 1, "Presolve thinks problem is unbounded" },
46 { COIN_PRESOLVE_INFEASUNBOUND, 509, 1, "Presolve thinks problem is infeasible AND unbounded???" },
47 { COIN_PRESOLVE_INTEGERMODS, 510, 1, "Presolve is modifying %d integer bounds and re-presolving" },
48 { COIN_PRESOLVE_POSTSOLVE, 511, 1, "After Postsolve, objective %g, infeasibilities - dual %g (%d), primal %g (%d)" },
49 { COIN_PRESOLVE_NEEDS_CLEANING, 512, 1, "Presolved model was optimal, full model needs cleaning up" },
50 { COIN_PRESOLVE_PASS, 513, 3, "%d rows dropped after presolve pass %d" },
51 #if PRESOLVE_DEBUG
52 { COIN_PRESOLDBG_FIRSTCHECK, 514, 3, "First occurrence of %s checks." },
53 { COIN_PRESOLDBG_RCOSTACC, 515, 3,
54 "rcost[%d] = %g should be %g |diff| = %g." },
55 { COIN_PRESOLDBG_RCOSTSTAT, 516, 3,
56 "rcost[%d] = %g inconsistent with status %s (%s)." },
57 { COIN_PRESOLDBG_STATSB, 517, 3,
58 "status[%d] = %s rcost = %g lb = %g val = %g ub = %g." },
59 { COIN_PRESOLDBG_DUALSTAT, 518, 3,
60 "dual[%d] = %g inconsistent with status %s (%s)." },
61 #endif
62 { COIN_GENERAL_INFO, 9, 1, "%s" },
63 { COIN_GENERAL_INFO2, 10, 2, "%s" },
64 { COIN_GENERAL_WARNING, 3007, 1, "%s" },
65 { COIN_DUMMY_END, 999999, 0, "" }
66 };
67 // **** aiutami!
68 static Coin_message italian[] = {
69 { COIN_MPS_LINE, 1, 1, "al numero %d %s" },
70 { COIN_MPS_STATS, 2, 1, "matrice %s ha %d file, %d colonne and %d elementi (diverso da zero)" },
71 { COIN_DUMMY_END, 999999, 0, "" }
72 };
73 /* Constructor */
CoinMessage(Language language)74 CoinMessage::CoinMessage(Language language)
75 : CoinMessages(sizeof(us_english) / sizeof(Coin_message))
76 {
77 language_ = language;
78 strcpy(source_, "Coin");
79 class_ = 2; // Coin
80 Coin_message *message = us_english;
81
82 while (message->internalNumber != COIN_DUMMY_END) {
83 CoinOneMessage oneMessage(message->externalNumber, message->detail,
84 message->message);
85 addMessage(message->internalNumber, oneMessage);
86 message++;
87 }
88 // Put into compact form
89 toCompact();
90 // now override any language ones
91
92 switch (language) {
93 case it:
94 message = italian;
95 break;
96
97 default:
98 message = NULL;
99 break;
100 }
101
102 // replace if any found
103 if (message) {
104 while (message->internalNumber != COIN_DUMMY_END) {
105 replaceMessage(message->internalNumber, message->message);
106 message++;
107 }
108 }
109 }
110
111 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
112 */
113