1/* $Id: ClpMessage.cpp 1753 2011-06-19 16:27:26Z stefan $ */
2// Copyright (C) 2000, 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#include "CoinPragma.hpp"
7#include "ClpMessage.hpp"
8/// Structure for use by ClpMessage.cpp
9typedef struct {
10 CLP_Message internalNumber;
11 int externalNumber; // or continuation
12 char detail;
13 const char * message;
14} Clp_message;
15static Clp_message clp_us_english[] = {
16 {CLP_SIMPLEX_FINISHED, 0, 1, "Optimal - objective value %g"},
17 {CLP_SIMPLEX_INFEASIBLE, 1, 1, "Primal infeasible - objective value %g"},
18 {CLP_SIMPLEX_UNBOUNDED, 2, 1, "Dual infeasible - objective value %g"},
19 {CLP_SIMPLEX_STOPPED, 3, 1, "Stopped - objective value %g"},
20 {CLP_SIMPLEX_ERROR, 4, 1, "Stopped due to errors - objective value %g"},
21 {CLP_SIMPLEX_INTERRUPT, 5, 1, "Stopped by event handler - objective value %g"},
22 {CLP_SIMPLEX_STATUS, 6, 1, "%d Obj %g%? Primal inf %g (%d)%? Dual inf %g (%d)%? w.o. free dual inf (%d)"},
23 {CLP_DUAL_BOUNDS, 25, 3, "Looking optimal checking bounds with %g"},
24 {CLP_SIMPLEX_ACCURACY, 60, 3, "Primal error %g, dual error %g"},
25 {CLP_SIMPLEX_BADFACTOR, 7, 2, "Singular factorization of basis - status %d"},
26 {CLP_SIMPLEX_BOUNDTIGHTEN, 8, 3, "Bounds were tightened %d times"},
27 {CLP_SIMPLEX_INFEASIBILITIES, 9, 1, "%d infeasibilities"},
28 {CLP_SIMPLEX_FLAG, 10, 3, "Flagging variable %c%d"},
29 {CLP_SIMPLEX_GIVINGUP, 11, 2, "Stopping as close enough"},
30 {CLP_DUAL_CHECKB, 12, 2, "New dual bound of %g"},
31 {CLP_DUAL_ORIGINAL, 13, 3, "Going back to original objective"},
32 {CLP_SIMPLEX_PERTURB, 14, 1, "Perturbing problem by %g %% of %g - largest nonzero change %g (%% %g) - largest zero change %g"},
33 {CLP_PRIMAL_ORIGINAL, 15, 2, "Going back to original tolerance"},
34 {CLP_PRIMAL_WEIGHT, 16, 2, "New infeasibility weight of %g"},
35 {CLP_PRIMAL_OPTIMAL, 17, 2, "Looking optimal with tolerance of %g"},
36 {CLP_SINGULARITIES, 18, 2, "%d total structurals rejected in initial factorization"},
37 {CLP_MODIFIEDBOUNDS, 19, 1, "%d variables/rows fixed as scaled bounds too close"},
38 {CLP_RIMSTATISTICS1, 20, 2, "Absolute values of scaled objective range from %g to %g"},
39 {CLP_RIMSTATISTICS2, 21, 2, "Absolute values of scaled bounds range from %g to %g, minimum gap %g"},
40 {CLP_RIMSTATISTICS3, 22, 2, "Absolute values of scaled rhs range from %g to %g, minimum gap %g"},
41 {CLP_POSSIBLELOOP, 23, 2, "Possible loop - %d matches (%x) after %d checks"},
42 {CLP_SMALLELEMENTS, 24, 1, "Matrix will be packed to eliminate %d small elements"},
43 {CLP_SIMPLEX_HOUSE1, 101, 32, "dirOut %d, dirIn %d, theta %g, out %g, dj %g, alpha %g"},
44 {CLP_SIMPLEX_HOUSE2, 102, 4, "%d %g In: %c%d Out: %c%d%? dj ratio %g distance %g%? dj %g distance %g"},
45 {CLP_SIMPLEX_NONLINEAR, 103, 4, "Primal nonlinear change %g (%d)"},
46 {CLP_SIMPLEX_FREEIN, 104, 32, "Free column in %d"},
47 {CLP_SIMPLEX_PIVOTROW, 105, 32, "Pivot row %d"},
48 {CLP_DUAL_CHECK, 106, 4, "Btran alpha %g, ftran alpha %g"},
49 {CLP_PRIMAL_DJ, 107, 4, "For %c%d btran dj %g, ftran dj %g"},
50 {CLP_PACKEDSCALE_INITIAL, 1001, 2, "Initial range of elements is %g to %g"},
51 {CLP_PACKEDSCALE_WHILE, 1002, 3, "Range of elements is %g to %g"},
52 {CLP_PACKEDSCALE_FINAL, 1003, 2, "Final range of elements is %g to %g"},
53 {CLP_PACKEDSCALE_FORGET, 1004, 2, "Not bothering to scale as good enough"},
54 {CLP_INITIALIZE_STEEP, 1005, 3, "Initializing steepest edge weights - old %g, new %g"},
55 {CLP_UNABLE_OPEN, 6001, 0, "Unable to open file %s for reading"},
56 {CLP_BAD_BOUNDS, 6002, 1, "%d bad bound pairs or bad objectives were found - first at %c%d"},
57 {CLP_BAD_MATRIX, 6003, 1, "Matrix has %d large values, first at column %d, row %d is %g"},
58 {CLP_LOOP, 6004, 1, "Can't get out of loop - stopping"},
59 {CLP_DUPLICATEELEMENTS, 26, 1, "Matrix will be packed to eliminate %d duplicate elements"},
60 {CLP_IMPORT_RESULT, 27, 1, "Model was imported from %s in %g seconds"},
61 {CLP_IMPORT_ERRORS, 3001, 1, " There were %d errors when importing model from %s"},
62 {CLP_EMPTY_PROBLEM, 3002, 1, "Empty problem - %d rows, %d columns and %d elements"},
63 {CLP_CRASH, 28, 1, "Crash put %d variables in basis, %d dual infeasibilities"},
64 {CLP_END_VALUES_PASS, 29, 1, "End of values pass after %d iterations"},
65 {CLP_QUADRATIC_BOTH, 108, 32, "%s %d (%g) and %d (%g) both basic"},
66 {CLP_QUADRATIC_PRIMAL_DETAILS, 109, 32, "coeff %g, %g, %g - dj %g - deriv zero at %g, sj at %g"},
67 {CLP_IDIOT_ITERATION, 30, 1, "%d infeas %g, obj %g - mu %g, its %d, %d interior"},
68 {CLP_INFEASIBLE, 3003, 1, "Analysis indicates model infeasible or unbounded"},
69 {CLP_MATRIX_CHANGE, 31, 2, "Matrix can not be converted into %s"},
70 {CLP_TIMING, 32, 1, "%s objective %.10g - %d iterations time %.2f2%?, Presolve %.2f%?, Idiot %.2f%?"},
71 {CLP_INTERVAL_TIMING, 33, 2, "%s took %.2f seconds (total %.2f)"},
72 {CLP_SPRINT, 34, 1, "Pass %d took %d iterations, objective %g, dual infeasibilities %g( %d)"},
73 {CLP_BARRIER_ITERATION, 35, 1, "%d Primal %g Dual %g Complementarity %g - %d fixed, rank %d"},
74 {CLP_BARRIER_OBJECTIVE_GAP, 36, 3, "Feasible - objective gap %g"},
75 {CLP_BARRIER_GONE_INFEASIBLE, 37, 2, "Infeasible"},
76 {CLP_BARRIER_CLOSE_TO_OPTIMAL, 38, 2, "Close to optimal after %d iterations with complementarity %g"},
77 {CLP_BARRIER_COMPLEMENTARITY, 39, 2, "Complementarity %g - %s"},
78 {CLP_BARRIER_EXIT2, 40, 1, "Exiting - using solution from iteration %d"},
79 {CLP_BARRIER_STOPPING, 41, 1, "Exiting on iterations"},
80 {CLP_BARRIER_EXIT, 42, 1, "Optimal %s"},
81 {CLP_BARRIER_SCALING, 43, 3, "Scaling %s by %g"},
82 {CLP_BARRIER_MU, 44, 3, "Changing mu from %g to %g"},
83 {CLP_BARRIER_INFO, 45, 3, "Detail - %s"},
84 {CLP_BARRIER_END, 46, 1, "At end primal/dual infeasibilities %g/%g, complementarity gap %g, objective %g"},
85 {CLP_BARRIER_ACCURACY, 47, 2, "Relative error in phase %d, %d passes %g => %g"},
86 {CLP_BARRIER_SAFE, 48, 2, "Initial safe primal value %g, objective norm %g"},
87 {CLP_BARRIER_NEGATIVE_GAPS, 49, 3, "%d negative gaps summing to %g"},
88 {CLP_BARRIER_REDUCING, 50, 2, "Reducing %s step from %g to %g"},
89 {CLP_BARRIER_DIAGONAL, 51, 3, "Range of diagonal values is %g to %g"},
90 {CLP_BARRIER_SLACKS, 52, 3, "%d slacks increased, %d decreased this iteration"},
91 {CLP_BARRIER_DUALINF, 53, 3, "Maximum dual infeasibility on fixed is %g"},
92 {CLP_BARRIER_KILLED, 54, 3, "%d variables killed this iteration"},
93 {CLP_BARRIER_ABS_DROPPED, 55, 2, "Absolute error on dropped rows is %g"},
94 {CLP_BARRIER_ABS_ERROR, 56, 2, "Primal error is %g and dual error is %g"},
95 {CLP_BARRIER_FEASIBLE, 57, 2, "Infeasibilities - bound %g , primal %g ,dual %g"},
96 {CLP_BARRIER_STEP, 58, 2, "Steps - primal %g ,dual %g , mu %g"},
97 {CLP_BARRIER_KKT, 6005, 0, "Quadratic barrier needs a KKT factorization"},
98 {CLP_RIM_SCALE, 59, 1, "Automatic rim scaling gives objective scale of %g and rhs/bounds scale of %g"},
99 {CLP_SLP_ITER, 58, 1, "Pass %d objective %g - drop %g, largest delta %g"},
100 {CLP_COMPLICATED_MODEL, 3004, 1, "Can not use addRows or addColumns on CoinModel as mixed, %d rows, %d columns"},
101 {CLP_BAD_STRING_VALUES, 3005, 1, "%d string elements had no values associated with them"},
102 {CLP_CRUNCH_STATS, 61, 2, "Crunch %d (%d) rows, %d (%d) columns and %d (%d) elements"},
103 {CLP_PARAMETRICS_STATS, 62, 1, "Theta %g - objective %g"},
104 {CLP_PARAMETRICS_STATS2, 63, 2, "Theta %g - objective %g, %s in, %s out"},
105#ifndef NO_FATHOM_PRINT
106 {CLP_FATHOM_STATUS, 63, 2, "Fathoming node %d - %d nodes (%d iterations) - current depth %d"},
107 {CLP_FATHOM_SOLUTION, 64, 1, "Fathoming node %d - solution of %g after %d nodes at depth %d"},
108 {CLP_FATHOM_FINISH, 65, 1, "Fathoming node %d (depth %d) took %d nodes (%d iterations) - maximum depth %d"},
109#endif
110 {CLP_GENERAL, 1000, 1, "%s"},
111 {CLP_GENERAL2, 1001, 2, "%s"},
112 {CLP_DUMMY_END, 999999, 0, ""}
113};
114static Clp_message uk_english[] = {
115 {
116 CLP_SIMPLEX_FINISHED, 0, 1, "Optimal - objective value %g,\
117 okay CLP can solve some LPs but you really need Xpress from Dash Associates :-)"
118 },
119 {CLP_DUMMY_END, 999999, 0, ""}
120};
121/* Constructor */
122ClpMessage::ClpMessage(Language language) :
123 CoinMessages(sizeof(clp_us_english) / sizeof(Clp_message))
124{
125 language_ = language;
126 strcpy(source_, "Clp");
127 class_ = 1; //solver
128 Clp_message * message = clp_us_english;
129
130 while (message->internalNumber != CLP_DUMMY_END) {
131 CoinOneMessage oneMessage(message->externalNumber, message->detail,
132 message->message);
133 addMessage(message->internalNumber, oneMessage);
134 message ++;
135 }
136 // Put into compact form
137 toCompact();
138
139 // now override any language ones
140
141 switch (language) {
142 case uk_en:
143 message = uk_english;
144 break;
145
146 default:
147 message = NULL;
148 break;
149 }
150
151 // replace if any found
152 if (message) {
153 while (message->internalNumber != CLP_DUMMY_END) {
154 replaceMessage(message->internalNumber, message->message);
155 message ++;
156 }
157 }
158}
159