source: stable/1.6/Clp/src/ClpSolve.hpp @ 1609

Last change on this file since 1609 was 1055, checked in by forrest, 13 years ago

out };

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 7.0 KB
Line 
1// Copyright (C) 2003, International Business Machines
2// Corporation and others.  All Rights Reserved.
3
4/*
5   Authors
6   
7   John Forrest
8
9 */
10#ifndef ClpSolve_H
11#define ClpSolve_H
12
13/**
14    This is a very simple class to guide algorithms.  It is used to tidy up
15    passing parameters to initialSolve and maybe for output from that
16
17*/
18
19class ClpSolve  {
20
21public:
22
23  /** enums for solve function */
24  enum SolveType {
25    useDual=0,
26    usePrimal,
27    usePrimalorSprint,
28    useBarrier,
29    useBarrierNoCross,
30    automatic,
31    notImplemented
32  };
33  enum PresolveType {
34    presolveOn=0,
35    presolveOff,
36    presolveNumber,
37    presolveNumberCost
38  };
39
40  /**@name Constructors and destructor and copy */
41  //@{
42  /// Default constructor
43  ClpSolve (  );
44  /// Constructor when you really know what you are doing
45  ClpSolve ( SolveType method, PresolveType presolveType,
46             int numberPasses, int options[6],
47             int extraInfo[6], int independentOptions[3]);
48  /// Generates code for above constructor
49  void generateCpp(FILE * fp);
50  /// Copy constructor.
51  ClpSolve(const ClpSolve &);
52  /// Assignment operator. This copies the data
53    ClpSolve & operator=(const ClpSolve & rhs);
54  /// Destructor
55   ~ClpSolve (  );
56  //@}
57
58  /**@name Functions most useful to user */
59  //@{
60  /** Special options - bits
610      4 - use crash (default allslack in dual, idiot in primal)
62      8 - all slack basis in primal
632      16 - switch off interrupt handling
643      32 - do not try and make plus minus one matrix
65      64 - do not use sprint even if problem looks good
66   */
67  /** which translation is:
68      which:
69      0 - startup in Dual  (nothing if basis exists).:
70                   0 - no basis
71                   1 - crash
72                   2 - use initiative about idiot! but no crash
73      1 - startup in Primal (nothing if basis exists):
74                   0 - use initiative
75                   1 - use crash
76                   2 - use idiot and look at further info
77                   3 - use sprint and look at further info
78                   4 - use all slack
79                   5 - use initiative but no idiot
80                   6 - use initiative but no sprint
81                   7 - use initiative but no crash
82                   8 - do allslack or idiot
83                   9 - do allslack or sprint
84                   10 - slp before
85                   11 - no nothing and primal(0)
86      2 - interrupt handling - 0 yes, 1 no (for threadsafe)
87      3 - whether to make +- 1matrix - 0 yes, 1 no
88      4 - for barrier
89                   0 - dense cholesky
90                   1 - Wssmp allowing some long columns
91                   2 - Wssmp not allowing long columns
92                   3 - Wssmp using KKT
93                   4 - Using Florida ordering
94                   8 - bit set to do scaling
95                   16 - set to be aggressive with gamma/delta?
96                   32 - Use KKT
97      5 - for presolve
98                   1 - switch off dual stuff
99      6 - for detailed printout (initially just presolve)
100                   1 - presolve statistics
101  */
102  void setSpecialOption(int which,int value,int extraInfo=-1);
103  int getSpecialOption(int which) const;
104
105  /// Solve types
106  void setSolveType(SolveType method, int extraInfo=-1);
107  SolveType getSolveType();
108
109  // Presolve types
110  void setPresolveType(PresolveType amount, int extraInfo=-1);
111  PresolveType getPresolveType();
112  int getPresolvePasses() const;
113  /// Extra info for idiot (or sprint)
114  int getExtraInfo(int which) const;
115  /** Say to return at once if infeasible,
116      default is to solve */
117  void setInfeasibleReturn(bool trueFalse);
118  inline bool infeasibleReturn() const
119  { return independentOptions_[0]!=0;}
120  /// Whether we want to do dual part of presolve
121  inline bool doDual() const
122  { return (independentOptions_[1]&1)==0;}
123  inline void setDoDual(bool doDual)
124  { if (doDual) independentOptions_[1]  &= ~1; else independentOptions_[1] |= 1;}
125  /// Whether we want to do singleton part of presolve
126  inline bool doSingleton() const
127  { return (independentOptions_[1]&2)==0;}
128  inline void setDoSingleton(bool doSingleton)
129  { if (doSingleton) independentOptions_[1]  &= ~2; else independentOptions_[1] |= 2;}
130  /// Whether we want to do doubleton part of presolve
131  inline bool doDoubleton() const
132  { return (independentOptions_[1]&4)==0;}
133  inline void setDoDoubleton(bool doDoubleton)
134  { if (doDoubleton) independentOptions_[1]  &= ~4; else independentOptions_[1] |= 4;}
135  /// Whether we want to do tripleton part of presolve
136  inline bool doTripleton() const
137  { return (independentOptions_[1]&8)==0;}
138  inline void setDoTripleton(bool doTripleton)
139  { if (doTripleton) independentOptions_[1]  &= ~8; else independentOptions_[1] |= 8;}
140  /// Whether we want to do tighten part of presolve
141  inline bool doTighten() const
142  { return (independentOptions_[1]&16)==0;}
143  inline void setDoTighten(bool doTighten)
144  { if (doTighten) independentOptions_[1]  &= ~16; else independentOptions_[1] |= 16;}
145  /// Whether we want to do forcing part of presolve
146  inline bool doForcing() const
147  { return (independentOptions_[1]&32)==0;}
148  inline void setDoForcing(bool doForcing)
149  { if (doForcing) independentOptions_[1]  &= ~32; else independentOptions_[1] |= 32;}
150  /// Whether we want to do impliedfree part of presolve
151  inline bool doImpliedFree() const
152  { return (independentOptions_[1]&64)==0;}
153  inline void setDoImpliedFree(bool doImpliedfree)
154  { if (doImpliedfree) independentOptions_[1]  &= ~64; else independentOptions_[1] |= 64;}
155  /// Whether we want to do dupcol part of presolve
156  inline bool doDupcol() const
157  { return (independentOptions_[1]&128)==0;}
158  inline void setDoDupcol(bool doDupcol)
159  { if (doDupcol) independentOptions_[1]  &= ~128; else independentOptions_[1] |= 128;}
160  /// Whether we want to do duprow part of presolve
161  inline bool doDuprow() const
162  { return (independentOptions_[1]&256)==0;}
163  inline void setDoDuprow(bool doDuprow)
164  { if (doDuprow) independentOptions_[1]  &= ~256; else independentOptions_[1] |= 256;}
165  /// Whether we want to do singleton column part of presolve
166  inline bool doSingletonColumn() const
167  { return (independentOptions_[1]&512)==0;}
168  inline void setDoSingletonColumn(bool doSingleton)
169  { if (doSingleton) independentOptions_[1]  &= ~512; else independentOptions_[1] |= 512;}
170  /// Set whole group
171  inline int presolveActions() const
172  { return independentOptions_[1]&0xffff;}
173  inline void setPresolveActions(int action)
174  { independentOptions_[1]  = (independentOptions_[1]&0xffff0000)|(action&0xffff);}
175  /// Largest column for substitution (normally 3)
176  inline int substitution() const
177  { return independentOptions_[2];}
178  inline void setSubstitution(int value)
179  { independentOptions_[2] = value;}
180  //@}
181
182////////////////// data //////////////////
183private:
184
185  /**@name data.
186  */
187  //@{
188  /// Solve type
189  SolveType method_;
190  /// Presolve type
191  PresolveType presolveType_;
192  /// Amount of presolve
193  int numberPasses_;
194  /// Options - last is switch for OsiClp
195  int options_[7];
196  /// Extra information
197  int extraInfo_[7];
198  /** Extra algorithm dependent options
199      0 - if set return from clpsolve if infeasible
200      1 - To be copied over to presolve options
201      2 - max substitution level
202  */
203  int independentOptions_[3];
204  //@}
205};
206#endif
Note: See TracBrowser for help on using the repository browser.