1 | /* $Id: ClpLinearObjective.hpp 2385 2019-01-06 19:43:06Z stefan $ */ |
---|
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 | ///@name Stuff |
---|
21 | //@{ |
---|
22 | |
---|
23 | /** Returns objective coefficients. |
---|
24 | |
---|
25 | Offset is always set to 0.0. All other parameters unused. |
---|
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 ¤tObj, |
---|
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 | ///@name Constructors and destructors |
---|
59 | //@{ |
---|
60 | /// Default Constructor |
---|
61 | ClpLinearObjective(); |
---|
62 | |
---|
63 | /// Constructor from objective |
---|
64 | ClpLinearObjective(const double *objective, int numberColumns); |
---|
65 | |
---|
66 | /// Copy constructor |
---|
67 | ClpLinearObjective(const ClpLinearObjective &); |
---|
68 | /** Subset constructor. Duplicates are allowed |
---|
69 | and order is as given. |
---|
70 | */ |
---|
71 | ClpLinearObjective(const ClpLinearObjective &rhs, int numberColumns, |
---|
72 | const int *whichColumns); |
---|
73 | |
---|
74 | /// Assignment operator |
---|
75 | ClpLinearObjective &operator=(const ClpLinearObjective &rhs); |
---|
76 | |
---|
77 | /// Destructor |
---|
78 | virtual ~ClpLinearObjective(); |
---|
79 | |
---|
80 | /// Clone |
---|
81 | virtual ClpObjective *clone() const; |
---|
82 | /** Subset clone. Duplicates are allowed |
---|
83 | and order is as given. |
---|
84 | */ |
---|
85 | virtual ClpObjective *subsetClone(int numberColumns, |
---|
86 | const int *whichColumns) const; |
---|
87 | |
---|
88 | //@} |
---|
89 | |
---|
90 | //--------------------------------------------------------------------------- |
---|
91 | |
---|
92 | private: |
---|
93 | ///@name Private member data |
---|
94 | /// Objective |
---|
95 | double *objective_; |
---|
96 | /// number of columns |
---|
97 | int numberColumns_; |
---|
98 | //@} |
---|
99 | }; |
---|
100 | |
---|
101 | #endif |
---|
102 | |
---|
103 | /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2 |
---|
104 | */ |
---|