source: trunk/Clp/src/ClpQuadraticObjective.hpp @ 2470

Last change on this file since 2470 was 2385, checked in by unxusr, 9 months ago

formatting

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.7 KB
RevLine 
[1370]1/* $Id: ClpQuadraticObjective.hpp 2385 2019-01-06 19:43:06Z stefan $ */
[225]2// Copyright (C) 2003, International Business Machines
3// Corporation and others.  All Rights Reserved.
[1665]4// This code is licensed under the terms of the Eclipse Public License (EPL).
5
[225]6#ifndef ClpQuadraticObjective_H
7#define ClpQuadraticObjective_H
8
9#include "ClpObjective.hpp"
10#include "CoinPackedMatrix.hpp"
11
12//#############################################################################
13
14/** Quadratic Objective Class
15
16*/
17
18class ClpQuadraticObjective : public ClpObjective {
[1502]19
[225]20public:
[2385]21  ///@name Stuff
22  //@{
[393]23
[2385]24  /** Returns gradient.  If Quadratic then solution may be NULL,
[1525]25         also returns an offset (to be added to current one)
26         If refresh is false then uses last solution
27         Uses model for scaling
28         includeLinear 0 - no, 1 as is, 2 as feasible
29     */
[2385]30  virtual double *gradient(const ClpSimplex *model,
31    const double *solution, double &offset, bool refresh,
32    int includeLinear = 2);
33  /// Resize objective
34  /** Returns reduced gradient.Returns an offset (to be added to current one).
[1525]35     */
[2385]36  virtual double reducedGradient(ClpSimplex *model, double *region,
37    bool useFeasibleCosts);
38  /** Returns step length which gives minimum of objective for
[1525]39         solution + theta * change vector up to maximum theta.
[225]40
[1525]41         arrays are numberColumns+numberRows
42         Also sets current objective, predicted and at maximumTheta
[1502]43     */
[2385]44  virtual double stepLength(ClpSimplex *model,
45    const double *solution,
46    const double *change,
47    double maximumTheta,
48    double &currentObj,
49    double &predictedObj,
50    double &thetaObj);
51  /// Return objective value (without any ClpModel offset) (model may be NULL)
52  virtual double objectiveValue(const ClpSimplex *model, const double *solution) const;
53  virtual void resize(int newNumberColumns);
54  /// Delete columns in  objective
55  virtual void deleteSome(int numberToDelete, const int *which);
56  /// Scale objective
57  virtual void reallyScale(const double *columnScale);
58  /** Given a zeroed array sets nonlinear columns to 1.
[1525]59         Returns number of nonlinear columns
60      */
[2385]61  virtual int markNonlinear(char *which);
[1502]62
[2385]63  //@}
[1502]64
[2385]65  ///@name Constructors and destructors
66  //@{
67  /// Default Constructor
68  ClpQuadraticObjective();
[1502]69
[2385]70  /// Constructor from objective
71  ClpQuadraticObjective(const double *linearObjective, int numberColumns,
72    const CoinBigIndex *start,
73    const int *column, const double *element,
74    int numberExtendedColumns_ = -1);
[1502]75
[2385]76  /** Copy constructor .
[1525]77         If type is -1 then make sure half symmetric,
78         if +1 then make sure full
79     */
[2385]80  ClpQuadraticObjective(const ClpQuadraticObjective &rhs, int type = 0);
81  /** Subset constructor.  Duplicates are allowed
[1525]82         and order is as given.
83     */
[2385]84  ClpQuadraticObjective(const ClpQuadraticObjective &rhs, int numberColumns,
85    const int *whichColumns);
[1502]86
[2385]87  /// Assignment operator
88  ClpQuadraticObjective &operator=(const ClpQuadraticObjective &rhs);
[1502]89
[2385]90  /// Destructor
91  virtual ~ClpQuadraticObjective();
[1502]92
[2385]93  /// Clone
94  virtual ClpObjective *clone() const;
95  /** Subset clone.  Duplicates are allowed
[1525]96         and order is as given.
97     */
[2385]98  virtual ClpObjective *subsetClone(int numberColumns,
99    const int *whichColumns) const;
[1502]100
[2385]101  /** Load up quadratic objective.  This is stored as a CoinPackedMatrix */
102  void loadQuadraticObjective(const int numberColumns,
103    const CoinBigIndex *start,
104    const int *column, const double *element,
105    int numberExtendedColumns = -1);
106  void loadQuadraticObjective(const CoinPackedMatrix &matrix);
107  /// Get rid of quadratic objective
108  void deleteQuadraticObjective();
109  //@}
110  ///@name Gets and sets
111  //@{
112  /// Quadratic objective
113  inline CoinPackedMatrix *quadraticObjective() const
114  {
115    return quadraticObjective_;
116  }
117  /// Linear objective
118  inline double *linearObjective() const
119  {
120    return objective_;
121  }
122  /// Length of linear objective which could be bigger
123  inline int numberExtendedColumns() const
124  {
125    return numberExtendedColumns_;
126  }
127  /// Number of columns in quadratic objective
128  inline int numberColumns() const
129  {
130    return numberColumns_;
131  }
132  /// If a full or half matrix
133  inline bool fullMatrix() const
134  {
135    return fullMatrix_;
136  }
137  //@}
[1502]138
[2385]139  //---------------------------------------------------------------------------
[1502]140
[225]141private:
[2385]142  ///@name Private member data
143  /// Quadratic objective
144  CoinPackedMatrix *quadraticObjective_;
145  /// Objective
146  double *objective_;
147  /// Gradient
148  double *gradient_;
149  /// Useful to have number of columns about
150  int numberColumns_;
151  /// Also length of linear objective which could be bigger
152  int numberExtendedColumns_;
153  /// True if full symmetric matrix, false if half
154  bool fullMatrix_;
155  //@}
[225]156};
157
158#endif
[2385]159
160/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
161*/
Note: See TracBrowser for help on using the repository browser.