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