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