1 | /* $Id: ClpSimplexNonlinear.hpp 2385 2019-01-06 19:43:06Z stefan $ */ |
---|
2 | // Copyright (C) 2004, 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 | Authors |
---|
7 | |
---|
8 | John Forrest |
---|
9 | |
---|
10 | */ |
---|
11 | #ifndef ClpSimplexNonlinear_H |
---|
12 | #define ClpSimplexNonlinear_H |
---|
13 | |
---|
14 | class ClpNonlinearInfo; |
---|
15 | class ClpQuadraticObjective; |
---|
16 | class ClpConstraint; |
---|
17 | |
---|
18 | #include "ClpSimplexPrimal.hpp" |
---|
19 | |
---|
20 | /** This solves non-linear LPs using the primal simplex method |
---|
21 | |
---|
22 | It inherits from ClpSimplexPrimal. It has no data of its own and |
---|
23 | is never created - only cast from a ClpSimplexPrimal object at algorithm time. |
---|
24 | If needed create new class and pass around |
---|
25 | |
---|
26 | */ |
---|
27 | |
---|
28 | class ClpSimplexNonlinear : public ClpSimplexPrimal { |
---|
29 | |
---|
30 | public: |
---|
31 | /**@name Description of algorithm */ |
---|
32 | //@{ |
---|
33 | /** Primal algorithms for reduced gradient |
---|
34 | At present we have two algorithms: |
---|
35 | |
---|
36 | */ |
---|
37 | /// A reduced gradient method. |
---|
38 | int primal(); |
---|
39 | /** Primal algorithm for quadratic |
---|
40 | Using a semi-trust region approach as for pooling problem |
---|
41 | This is in because I have it lying around |
---|
42 | */ |
---|
43 | int primalSLP(int numberPasses, double deltaTolerance, |
---|
44 | int otherOptions = 0); |
---|
45 | /// May use a cut approach for solving any LP |
---|
46 | int primalDualCuts(char *rowsIn, int startUp, int algorithm); |
---|
47 | /** Primal algorithm for nonlinear constraints |
---|
48 | Using a semi-trust region approach as for pooling problem |
---|
49 | This is in because I have it lying around |
---|
50 | |
---|
51 | */ |
---|
52 | int primalSLP(int numberConstraints, ClpConstraint **constraints, |
---|
53 | int numberPasses, double deltaTolerance); |
---|
54 | |
---|
55 | /** Creates direction vector. note longArray is long enough |
---|
56 | for rows and columns. If numberNonBasic 0 then is updated |
---|
57 | otherwise mode is ignored and those are used. |
---|
58 | Norms are only for those > 1.0e3*dualTolerance |
---|
59 | If mode is nonzero then just largest dj */ |
---|
60 | void directionVector(CoinIndexedVector *longArray, |
---|
61 | CoinIndexedVector *spare1, CoinIndexedVector *spare2, |
---|
62 | int mode, |
---|
63 | double &normFlagged, double &normUnflagged, |
---|
64 | int &numberNonBasic); |
---|
65 | /// Main part. |
---|
66 | int whileIterating(int &pivotMode); |
---|
67 | /** |
---|
68 | longArray has direction |
---|
69 | pivotMode - |
---|
70 | 0 - use all dual infeasible variables |
---|
71 | 1 - largest dj |
---|
72 | while >= 10 trying startup phase |
---|
73 | Returns 0 - can do normal iteration (basis change) |
---|
74 | 1 - no basis change |
---|
75 | 2 - if wants singleton |
---|
76 | 3 - if time to re-factorize |
---|
77 | If sequenceIn_ >=0 then that will be incoming variable |
---|
78 | */ |
---|
79 | int pivotColumn(CoinIndexedVector *longArray, |
---|
80 | CoinIndexedVector *rowArray, |
---|
81 | CoinIndexedVector *columnArray, |
---|
82 | CoinIndexedVector *spare, |
---|
83 | int &pivotMode, |
---|
84 | double &solutionError, |
---|
85 | double *array1); |
---|
86 | /** Refactorizes if necessary |
---|
87 | Checks if finished. Updates status. |
---|
88 | lastCleaned refers to iteration at which some objective/feasibility |
---|
89 | cleaning too place. |
---|
90 | |
---|
91 | type - 0 initial so set up save arrays etc |
---|
92 | - 1 normal -if good update save |
---|
93 | - 2 restoring from saved |
---|
94 | */ |
---|
95 | void statusOfProblemInPrimal(int &lastCleaned, int type, |
---|
96 | ClpSimplexProgress *progress, |
---|
97 | bool doFactorization, |
---|
98 | double &bestObjectiveWhenFlagged); |
---|
99 | /** Do last half of an iteration. |
---|
100 | Return codes |
---|
101 | Reasons to come out normal mode |
---|
102 | -1 normal |
---|
103 | -2 factorize now - good iteration |
---|
104 | -3 slight inaccuracy - refactorize - iteration done |
---|
105 | -4 inaccuracy - refactorize - no iteration |
---|
106 | -5 something flagged - go round again |
---|
107 | +2 looks unbounded |
---|
108 | +3 max iterations (iteration done) |
---|
109 | |
---|
110 | */ |
---|
111 | int pivotNonlinearResult(); |
---|
112 | //@} |
---|
113 | }; |
---|
114 | #endif |
---|
115 | |
---|
116 | /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2 |
---|
117 | */ |
---|