1 | // Copyright (C) 2003, International Business Machines |
---|
2 | // Corporation and others. All Rights Reserved. |
---|
3 | #ifndef ClpLinearObjective_H |
---|
4 | #define ClpLinearObjective_H |
---|
5 | |
---|
6 | #include "ClpObjective.hpp" |
---|
7 | |
---|
8 | //############################################################################# |
---|
9 | |
---|
10 | /** Linear Objective Class |
---|
11 | |
---|
12 | */ |
---|
13 | |
---|
14 | class ClpLinearObjective : public ClpObjective { |
---|
15 | |
---|
16 | public: |
---|
17 | |
---|
18 | ///@name Stuff |
---|
19 | //@{ |
---|
20 | |
---|
21 | /** Returns gradient. If Linear then solution may be NULL, |
---|
22 | also returns an offset (to be added to current one) |
---|
23 | If refresh is false then uses last solution |
---|
24 | Uses model for scaling |
---|
25 | includeLinear 0 - no, 1 as is, 2 as feasible |
---|
26 | */ |
---|
27 | virtual double * gradient(const ClpSimplex * model, |
---|
28 | const double * solution, double & offset,bool refresh, |
---|
29 | int includeLinear=2); |
---|
30 | /** Returns reduced gradient.Returns an offset (to be added to current one). |
---|
31 | */ |
---|
32 | virtual double reducedGradient(ClpSimplex * model, double * region, |
---|
33 | bool useFeasibleCosts); |
---|
34 | /** Returns step length which gives minimum of objective for |
---|
35 | solution + theta * change vector up to maximum theta. |
---|
36 | |
---|
37 | arrays are numberColumns+numberRows |
---|
38 | Also sets current objective, predicted and at maximumTheta |
---|
39 | */ |
---|
40 | virtual double stepLength(ClpSimplex * model, |
---|
41 | const double * solution, |
---|
42 | const double * change, |
---|
43 | double maximumTheta, |
---|
44 | double & currentObj, |
---|
45 | double & predictedObj, |
---|
46 | double & thetaObj); |
---|
47 | /// Return objective value (without any ClpModel offset) (model may be NULL) |
---|
48 | virtual double objectiveValue(const ClpSimplex * model, const double * solution) const ; |
---|
49 | /// Resize objective |
---|
50 | virtual void resize(int newNumberColumns) ; |
---|
51 | /// Delete columns in objective |
---|
52 | virtual void deleteSome(int numberToDelete, const int * which) ; |
---|
53 | /// Scale objective |
---|
54 | virtual void reallyScale(const double * columnScale) ; |
---|
55 | |
---|
56 | //@} |
---|
57 | |
---|
58 | |
---|
59 | ///@name Constructors and destructors |
---|
60 | //@{ |
---|
61 | /// Default Constructor |
---|
62 | ClpLinearObjective(); |
---|
63 | |
---|
64 | /// Constructor from objective |
---|
65 | ClpLinearObjective(const double * objective, int numberColumns); |
---|
66 | |
---|
67 | /// Copy constructor |
---|
68 | ClpLinearObjective(const ClpLinearObjective &); |
---|
69 | /** Subset constructor. Duplicates are allowed |
---|
70 | and order is as given. |
---|
71 | */ |
---|
72 | ClpLinearObjective (const ClpLinearObjective &rhs,int numberColumns, |
---|
73 | const int * whichColumns) ; |
---|
74 | |
---|
75 | /// Assignment operator |
---|
76 | ClpLinearObjective & operator=(const ClpLinearObjective& rhs); |
---|
77 | |
---|
78 | /// Destructor |
---|
79 | virtual ~ClpLinearObjective (); |
---|
80 | |
---|
81 | /// Clone |
---|
82 | virtual ClpObjective * clone() const; |
---|
83 | /** Subset clone. Duplicates are allowed |
---|
84 | and order is as given. |
---|
85 | */ |
---|
86 | virtual ClpObjective * subsetClone (int numberColumns, |
---|
87 | const int * whichColumns) const; |
---|
88 | |
---|
89 | //@} |
---|
90 | |
---|
91 | //--------------------------------------------------------------------------- |
---|
92 | |
---|
93 | private: |
---|
94 | ///@name Private member data |
---|
95 | /// Objective |
---|
96 | double * objective_; |
---|
97 | /// number of columns |
---|
98 | int numberColumns_; |
---|
99 | //@} |
---|
100 | }; |
---|
101 | |
---|
102 | #endif |
---|