source: tags/root-devel-1/ClpMessage.cpp @ 778

Last change on this file since 778 was 2, checked in by forrest, 17 years ago

Adding Clp to development branch

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1// Copyright (C) 2000, International Business Machines
2// Corporation and others.  All Rights Reserved.
3#if defined(_MSC_VER)
4// Turn off compiler warning about long names
5#  pragma warning(disable:4786)
6#endif
7
8#include "ClpMessage.hpp"
9
10typedef struct {
11  CLP_Message internalNumber;
12  int externalNumber; // or continuation
13  char detail;
14  const char * message;
15} Clp_message;
16static Clp_message us_english[]=
17{
18  {CLP_SIMPLEX_FINISHED,0,1,"Optimal - objective value %g"},
19  {CLP_SIMPLEX_INFEASIBLE,1,1,"Primal infeasible - objective value %g"},
20  {CLP_SIMPLEX_UNBOUNDED,2,1,"Dual infeasible - objective value %g"},
21  {CLP_SIMPLEX_STOPPED,3,1,"Stopped - objective value %g"},
22  {CLP_SIMPLEX_ERROR,4,1,"Stopped due to errors - objective value %g"},
23  {CLP_SIMPLEX_STATUS,5,1,"%d  Objective %g%? Primal infeas %g (%d)%? Dual infeas %g (%d)%? without free dual infeas (%d)"},
24  {CLP_DUAL_BOUNDS,5,3,"Looking optimal checking bounds with %g"},
25  {CLP_SIMPLEX_ACCURACY,6,1,"Primal error %g, dual error %g"},
26  {CLP_SIMPLEX_BADFACTOR,7,1,"Singular factorization of basis - status %d"},
27  {CLP_SIMPLEX_BOUNDTIGHTEN,8,1,"Bounds were tightened %d times"},
28  {CLP_SIMPLEX_INFEASIBILITIES,9,1,"%d infeasibilities"},
29  {CLP_SIMPLEX_FLAG,10,1,"Flagging variable %c%d"},
30  {CLP_SIMPLEX_GIVINGUP,11,2,"Stopping as close enough"},
31  {CLP_DUAL_CHECKB,12,3,"Looking infeasible checking bounds with %g"},
32  {CLP_DUAL_ORIGINAL,13,3,"Going back to original objective"},
33  {CLP_SIMPLEX_PERTURB,14,1,"Perturbing problem by %g"},
34  {CLP_PRIMAL_ORIGINAL,15,2,"Going back to original tolerance"},
35  {CLP_PRIMAL_WEIGHT,16,2,"New infeasibility weight of %g"},
36  {CLP_PRIMAL_OPTIMAL,17,2,"Looking optimal with tolerance of %g"},
37  {CLP_SIMPLEX_HOUSE1,101,32,"dirOut %d, dirIn %d, theta %g, out %g, dj %g, alpha %g"},
38  {CLP_SIMPLEX_HOUSE2,102,4,"%d %g In: %c%d Out: %c%d%? dj ratio %g distance %g%? dj %g distance %g"},
39  {CLP_SIMPLEX_NONLINEAR,103,4,"Primal nonlinear change %g (%d)"},
40  {CLP_SIMPLEX_FREEIN,104,32,"Free column in %d"},
41  {CLP_SIMPLEX_PIVOTROW,105,32,"Pivot row %d"},
42  {CLP_DUAL_CHECK,106,4,"Btran alpha %g, ftran alpha %g"},
43  {CLP_PRIMAL_DJ,107,4,"Btran dj %g, ftran dj %g"},
44  {CLP_PACKEDSCALE_INITIAL,1001,2,"Initial range of elements is %g to %g"},
45  {CLP_PACKEDSCALE_WHILE,1002,3,"Range of elements is %g to %g"},
46  {CLP_PACKEDSCALE_FINAL,1003,2,"Final range of elements is %g to %g"},
47  {CLP_PACKEDSCALE_FORGET,1004,2,"Not bothering to scale as good enough"},
48  {CLP_INITIALIZE_STEEP,1005,1,"Initializing steepest edge weights - old %g, new %g"},
49  {CLP_UNABLE_OPEN,6001,0,"Unable to open file %s for reading"},
50  {CLP_IMPORT_RESULT,18,1,"Model was imported from %s in %g seconds"},
51  {CLP_IMPORT_ERRORS,3001,1," There were %d errors when importing model from %s"},
52  {CLP_DUMMY_END,999999,0,""}
53};
54static Clp_message uk_english[]=
55{
56  {CLP_SIMPLEX_FINISHED,0,1,"Optimal - objective value %g,\
57 okay CLP can solve some LPs but you really need Xpress from Dash Associates :-)"},
58  {CLP_DUMMY_END,999999,0,""}
59};
60/* Constructor */
61ClpMessage::ClpMessage(Language language) :
62  OsiMessages(sizeof(us_english)/sizeof(Clp_message))
63{
64  language_=language;
65  strcpy(source_,"Clp");
66  Clp_message * message = us_english;
67
68  while (message->internalNumber!=CLP_DUMMY_END) {
69      OsiOneMessage oneMessage(message->externalNumber,message->detail,
70                message->message);
71    addMessage(message->internalNumber,oneMessage);
72    message ++;
73}
74
75  // now override any language ones
76
77  switch (language) {
78  case uk_en:
79    message = uk_english;
80    break;
81
82  default:
83    message=NULL;
84    break;
85  }
86
87  // replace if any found
88  if (message) {
89    while (message->internalNumber!=CLP_DUMMY_END) {
90      replaceMessage(message->internalNumber,message->message);
91      message ++;
92    }
93  }
94}
Note: See TracBrowser for help on using the repository browser.