1 | /* $Id: ClpParameters.hpp 2046 2014-08-14 04:13:10Z tkr $ */ |
---|
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 | /// Maximum wallclock running time in seconds - after, this action is as max iterations |
---|
64 | ClpMaxWallSeconds, |
---|
65 | /// Tolerance to use in presolve |
---|
66 | ClpPresolveTolerance, |
---|
67 | /** Just a marker, so that we can allocate a static sized array to store |
---|
68 | parameters. */ |
---|
69 | ClpLastDblParam |
---|
70 | }; |
---|
71 | |
---|
72 | |
---|
73 | enum ClpStrParam { |
---|
74 | /** Name of the problem. This is the found on the Name card of |
---|
75 | an mps file. */ |
---|
76 | ClpProbName = 0, |
---|
77 | /** Just a marker, so that we can allocate a static sized array to store |
---|
78 | parameters. */ |
---|
79 | ClpLastStrParam |
---|
80 | }; |
---|
81 | |
---|
82 | /// Copy (I don't like complexity of Coin version) |
---|
83 | template <class T> inline void |
---|
84 | ClpDisjointCopyN( const T * array, const int size, T * newArray) |
---|
85 | { |
---|
86 | memcpy(reinterpret_cast<void *> (newArray), array, size * sizeof(T)); |
---|
87 | } |
---|
88 | /// And set |
---|
89 | template <class T> inline void |
---|
90 | ClpFillN( T * array, const int size, T value) |
---|
91 | { |
---|
92 | int i; |
---|
93 | for (i = 0; i < size; i++) |
---|
94 | array[i] = value; |
---|
95 | } |
---|
96 | /// This returns a non const array filled with input from scalar or actual array |
---|
97 | template <class T> inline T* |
---|
98 | ClpCopyOfArray( const T * array, const int size, T value) |
---|
99 | { |
---|
100 | T * arrayNew = new T[size]; |
---|
101 | if (array) |
---|
102 | ClpDisjointCopyN(array, size, arrayNew); |
---|
103 | else |
---|
104 | ClpFillN ( arrayNew, size, value); |
---|
105 | return arrayNew; |
---|
106 | } |
---|
107 | |
---|
108 | /// This returns a non const array filled with actual array (or NULL) |
---|
109 | template <class T> inline T* |
---|
110 | ClpCopyOfArray( const T * array, const int size) |
---|
111 | { |
---|
112 | if (array) { |
---|
113 | T * arrayNew = new T[size]; |
---|
114 | ClpDisjointCopyN(array, size, arrayNew); |
---|
115 | return arrayNew; |
---|
116 | } else { |
---|
117 | return NULL; |
---|
118 | } |
---|
119 | } |
---|
120 | /// For a structure to be used by trusted code |
---|
121 | typedef struct { |
---|
122 | int typeStruct; // allocated as 1,2 etc |
---|
123 | int typeCall; |
---|
124 | void * data; |
---|
125 | } ClpTrustedData; |
---|
126 | #endif |
---|