source: trunk/Clp/src/ClpConstraintQuadratic.hpp @ 1035

Last change on this file since 1035 was 1035, checked in by forrest, 13 years ago

forgot to add ClpConstraint?

File size: 3.0 KB
Line 
1// Copyright (C) 2007, International Business Machines
2// Corporation and others.  All Rights Reserved.
3#ifndef ClpConstraintQuadratic_H
4#define ClpConstraintQuadratic_H
5
6#include "ClpConstraint.hpp"
7
8//#############################################################################
9
10/** Quadratic Constraint Class
11
12*/
13
14class ClpConstraintQuadratic : public ClpConstraint {
15 
16public:
17 
18  ///@name Stuff
19  //@{
20 
21 
22  /** Fills gradient.  If Quadratic then solution may be NULL,
23      also returns true value of function and offset so we can use x not deltaX in constraint
24      If refresh is false then uses last solution
25      Uses model for scaling
26      Returns non-zero if gradient udefined at current solution
27  */
28  virtual int gradient(const ClpSimplex * model,
29                       const double * solution,
30                       double * gradient,
31                       double & functionValue ,
32                       double & offset,
33                       bool useScaling=false,
34                       bool refresh=true) const ;
35  /// Resize constraint
36  virtual void resize(int newNumberColumns) ; 
37  /// Delete columns in  constraint
38  virtual void deleteSome(int numberToDelete, const int * which) ; 
39  /// Scale constraint
40  virtual void reallyScale(const double * columnScale) ;
41  /** Given a zeroed array sets nonquadratic columns to 1.
42      Returns number of nonquadratic columns
43   */
44  virtual int markNonlinear(char * which) const ;
45  /** Given a zeroed array sets possible nonzero coefficients to 1.
46      Returns number of nonzeros
47   */
48  virtual int markNonzero(char * which) const;
49  //@}
50 
51 
52  ///@name Constructors and destructors
53  //@{
54  /// Default Constructor
55  ClpConstraintQuadratic(); 
56 
57  /// Constructor from quadratic
58  ClpConstraintQuadratic(int row, int numberQuadraticColumns, int numberColumns,
59                         const CoinBigIndex * start,
60                         const int * column, const double * element);
61 
62  /** Copy constructor .
63  */
64  ClpConstraintQuadratic(const ClpConstraintQuadratic & rhs);
65
66  /// Assignment operator
67  ClpConstraintQuadratic & operator=(const ClpConstraintQuadratic& rhs);
68 
69  /// Destructor
70  virtual ~ClpConstraintQuadratic ();
71
72  /// Clone
73  virtual ClpConstraint * clone() const;
74  //@}
75  ///@name Gets and sets
76  //@{
77  /// Number of coefficients
78  virtual int numberCoefficients() const;
79  /// Number of columns in constraint
80  inline int numberColumns() const
81  {return numberColumns_;};
82  /// Column starts
83  inline CoinBigIndex * start() const
84  { return start_;}
85  /// Columns
86  inline const int * column() const
87  { return column_;};
88  /// Coefficients
89  inline const double * coefficient() const
90  { return coefficient_;};
91  //@}
92
93  //---------------------------------------------------------------------------
94 
95private:
96  ///@name Private member data
97  /// Column starts
98  CoinBigIndex * start_;
99  /// Column (if -1 then linear coefficient)
100  int * column_;
101  /// Coefficients
102  double * coefficient_;
103  /// Useful to have number of columns about
104  int numberColumns_;
105  /// Number of coefficients in gradient
106  int numberCoefficients_;
107  /// Number of quadratic columns
108  int numberQuadraticColumns_;
109  //@}
110};
111
112#endif
Note: See TracBrowser for help on using the repository browser.