1 | /* $Id: ClpParameters.hpp 1665 2011-01-04 17:55:54Z lou $ */ |
---|
2 | // Copyright (C) 2000, 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 | #ifndef _ClpParameters_H |
---|
7 | #define _ClpParameters_H |
---|
8 | |
---|
9 | /** This is where to put any useful stuff. |
---|
10 | |
---|
11 | */ |
---|
12 | enum ClpIntParam { |
---|
13 | /** The maximum number of iterations Clp can execute in the simplex methods |
---|
14 | */ |
---|
15 | ClpMaxNumIteration = 0, |
---|
16 | /** The maximum number of iterations Clp can execute in hotstart before |
---|
17 | terminating */ |
---|
18 | ClpMaxNumIterationHotStart, |
---|
19 | /** The name discipline; specifies how the solver will handle row and |
---|
20 | column names. |
---|
21 | - 0: Auto names: Names cannot be set by the client. Names of the form |
---|
22 | Rnnnnnnn or Cnnnnnnn are generated on demand when a name for a |
---|
23 | specific row or column is requested; nnnnnnn is derived from the row |
---|
24 | or column index. Requests for a vector of names return a vector with |
---|
25 | zero entries. |
---|
26 | - 1: Lazy names: Names supplied by the client are retained. Names of the |
---|
27 | form Rnnnnnnn or Cnnnnnnn are generated on demand if no name has been |
---|
28 | supplied by the client. Requests for a vector of names return a |
---|
29 | vector sized to the largest index of a name supplied by the client; |
---|
30 | some entries in the vector may be null strings. |
---|
31 | - 2: Full names: Names supplied by the client are retained. Names of the |
---|
32 | form Rnnnnnnn or Cnnnnnnn are generated on demand if no name has been |
---|
33 | supplied by the client. Requests for a vector of names return a |
---|
34 | vector sized to match the constraint system, and all entries will |
---|
35 | contain either the name specified by the client or a generated name. |
---|
36 | */ |
---|
37 | ClpNameDiscipline, |
---|
38 | /** Just a marker, so that we can allocate a static sized array to store |
---|
39 | parameters. */ |
---|
40 | ClpLastIntParam |
---|
41 | }; |
---|
42 | |
---|
43 | enum ClpDblParam { |
---|
44 | /** Set Dual objective limit. This is to be used as a termination criteria |
---|
45 | in methods where the dual objective monotonically changes (dual |
---|
46 | simplex). */ |
---|
47 | ClpDualObjectiveLimit, |
---|
48 | /** Primal objective limit. This is to be used as a termination |
---|
49 | criteria in methods where the primal objective monotonically changes |
---|
50 | (e.g., primal simplex) */ |
---|
51 | ClpPrimalObjectiveLimit, |
---|
52 | /** The maximum amount the dual constraints can be violated and still be |
---|
53 | considered feasible. */ |
---|
54 | ClpDualTolerance, |
---|
55 | /** The maximum amount the primal constraints can be violated and still be |
---|
56 | considered feasible. */ |
---|
57 | ClpPrimalTolerance, |
---|
58 | /** Objective function constant. This the value of the constant term in |
---|
59 | the objective function. */ |
---|
60 | ClpObjOffset, |
---|
61 | /// Maximum time in seconds - after this action is as max iterations |
---|
62 | ClpMaxSeconds, |
---|
63 | /// Tolerance to use in presolve |
---|
64 | ClpPresolveTolerance, |
---|
65 | /** Just a marker, so that we can allocate a static sized array to store |
---|
66 | parameters. */ |
---|
67 | ClpLastDblParam |
---|
68 | }; |
---|
69 | |
---|
70 | |
---|
71 | enum ClpStrParam { |
---|
72 | /** Name of the problem. This is the found on the Name card of |
---|
73 | an mps file. */ |
---|
74 | ClpProbName = 0, |
---|
75 | /** Just a marker, so that we can allocate a static sized array to store |
---|
76 | parameters. */ |
---|
77 | ClpLastStrParam |
---|
78 | }; |
---|
79 | |
---|
80 | /// Copy (I don't like complexity of Coin version) |
---|
81 | template <class T> inline void |
---|
82 | ClpDisjointCopyN( const T * array, const int size, T * newArray) |
---|
83 | { |
---|
84 | memcpy(reinterpret_cast<void *> (newArray), array, size * sizeof(T)); |
---|
85 | } |
---|
86 | /// And set |
---|
87 | template <class T> inline void |
---|
88 | ClpFillN( T * array, const int size, T value) |
---|
89 | { |
---|
90 | int i; |
---|
91 | for (i = 0; i < size; i++) |
---|
92 | array[i] = value; |
---|
93 | } |
---|
94 | /// This returns a non const array filled with input from scalar or actual array |
---|
95 | template <class T> inline T* |
---|
96 | ClpCopyOfArray( const T * array, const int size, T value) |
---|
97 | { |
---|
98 | T * arrayNew = new T[size]; |
---|
99 | if (array) |
---|
100 | ClpDisjointCopyN(array, size, arrayNew); |
---|
101 | else |
---|
102 | ClpFillN ( arrayNew, size, value); |
---|
103 | return arrayNew; |
---|
104 | } |
---|
105 | |
---|
106 | /// This returns a non const array filled with actual array (or NULL) |
---|
107 | template <class T> inline T* |
---|
108 | ClpCopyOfArray( const T * array, const int size) |
---|
109 | { |
---|
110 | if (array) { |
---|
111 | T * arrayNew = new T[size]; |
---|
112 | ClpDisjointCopyN(array, size, arrayNew); |
---|
113 | return arrayNew; |
---|
114 | } else { |
---|
115 | return NULL; |
---|
116 | } |
---|
117 | } |
---|
118 | /// For a structure to be used by trusted code |
---|
119 | typedef struct { |
---|
120 | int typeStruct; // allocated as 1,2 etc |
---|
121 | int typeCall; |
---|
122 | void * data; |
---|
123 | } ClpTrustedData; |
---|
124 | #endif |
---|