1 | /* $Id: ClpSimplexNonlinear.hpp 1665 2011-01-04 17:55:54Z forrest $ */ |
---|
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 | |
---|
32 | /**@name Description of algorithm */ |
---|
33 | //@{ |
---|
34 | /** Primal algorithms for reduced gradient |
---|
35 | At present we have two algorithms: |
---|
36 | |
---|
37 | */ |
---|
38 | /// A reduced gradient method. |
---|
39 | int primal(); |
---|
40 | /** Primal algorithm for quadratic |
---|
41 | Using a semi-trust region approach as for pooling problem |
---|
42 | This is in because I have it lying around |
---|
43 | |
---|
44 | */ |
---|
45 | int primalSLP(int numberPasses, double deltaTolerance); |
---|
46 | /** Primal algorithm for nonlinear constraints |
---|
47 | Using a semi-trust region approach as for pooling problem |
---|
48 | This is in because I have it lying around |
---|
49 | |
---|
50 | */ |
---|
51 | int primalSLP(int numberConstraints, ClpConstraint ** constraints, |
---|
52 | int numberPasses, double deltaTolerance); |
---|
53 | |
---|
54 | /** Creates direction vector. note longArray is long enough |
---|
55 | for rows and columns. If numberNonBasic 0 then is updated |
---|
56 | otherwise mode is ignored and those are used. |
---|
57 | Norms are only for those > 1.0e3*dualTolerance |
---|
58 | If mode is nonzero then just largest dj */ |
---|
59 | void directionVector (CoinIndexedVector * longArray, |
---|
60 | CoinIndexedVector * spare1, CoinIndexedVector * spare2, |
---|
61 | int mode, |
---|
62 | double & normFlagged, double & normUnflagged, |
---|
63 | int & numberNonBasic); |
---|
64 | /// Main part. |
---|
65 | int whileIterating (int & pivotMode); |
---|
66 | /** |
---|
67 | longArray has direction |
---|
68 | pivotMode - |
---|
69 | 0 - use all dual infeasible variables |
---|
70 | 1 - largest dj |
---|
71 | while >= 10 trying startup phase |
---|
72 | Returns 0 - can do normal iteration (basis change) |
---|
73 | 1 - no basis change |
---|
74 | 2 - if wants singleton |
---|
75 | 3 - if time to re-factorize |
---|
76 | If sequenceIn_ >=0 then that will be incoming variable |
---|
77 | */ |
---|
78 | int pivotColumn(CoinIndexedVector * longArray, |
---|
79 | CoinIndexedVector * rowArray, |
---|
80 | CoinIndexedVector * columnArray, |
---|
81 | CoinIndexedVector * spare, |
---|
82 | int & pivotMode, |
---|
83 | double & solutionError, |
---|
84 | double * array1); |
---|
85 | /** Refactorizes if necessary |
---|
86 | Checks if finished. Updates status. |
---|
87 | lastCleaned refers to iteration at which some objective/feasibility |
---|
88 | cleaning too place. |
---|
89 | |
---|
90 | type - 0 initial so set up save arrays etc |
---|
91 | - 1 normal -if good update save |
---|
92 | - 2 restoring from saved |
---|
93 | */ |
---|
94 | void statusOfProblemInPrimal(int & lastCleaned, int type, |
---|
95 | ClpSimplexProgress * progress, |
---|
96 | bool doFactorization, |
---|
97 | double & bestObjectiveWhenFlagged); |
---|
98 | /** Do last half of an iteration. |
---|
99 | Return codes |
---|
100 | Reasons to come out normal mode |
---|
101 | -1 normal |
---|
102 | -2 factorize now - good iteration |
---|
103 | -3 slight inaccuracy - refactorize - iteration done |
---|
104 | -4 inaccuracy - refactorize - no iteration |
---|
105 | -5 something flagged - go round again |
---|
106 | +2 looks unbounded |
---|
107 | +3 max iterations (iteration done) |
---|
108 | |
---|
109 | */ |
---|
110 | int pivotNonlinearResult(); |
---|
111 | //@} |
---|
112 | |
---|
113 | }; |
---|
114 | #endif |
---|
115 | |
---|