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

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

forgot to add ClpConstraint?

File size: 2.7 KB
Line 
1// Copyright (C) 2007, International Business Machines
2// Corporation and others.  All Rights Reserved.
3#ifndef ClpConstraintLinear_H
4#define ClpConstraintLinear_H
5
6#include "ClpConstraint.hpp"
7
8//#############################################################################
9
10/** Linear Constraint Class
11
12*/
13
14class ClpConstraintLinear : public ClpConstraint {
15 
16public:
17 
18  ///@name Stuff
19  //@{
20 
21 
22  /** Fills gradient.  If Linear 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 nonlinear columns to 1.
42      Returns number of nonlinear 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  ClpConstraintLinear(); 
56 
57  /// Constructor from constraint
58  ClpConstraintLinear(int row, int numberCoefficients, int numberColumns,
59                      const int * column, const double * element);
60 
61  /** Copy constructor .
62  */
63  ClpConstraintLinear(const ClpConstraintLinear & rhs);
64
65  /// Assignment operator
66  ClpConstraintLinear & operator=(const ClpConstraintLinear& rhs);
67 
68  /// Destructor
69  virtual ~ClpConstraintLinear ();
70
71  /// Clone
72  virtual ClpConstraint * clone() const;
73  //@}
74  ///@name Gets and sets
75  //@{
76  /// Number of coefficients
77  virtual int numberCoefficients() const;
78  /// Number of columns in linear constraint
79  inline int numberColumns() const
80  {return numberColumns_;};
81  /// Columns
82  inline const int * column() const
83  { return column_;};
84  /// Coefficients
85  inline const double * coefficient() const
86  { return coefficient_;};
87  //@}
88
89  //---------------------------------------------------------------------------
90 
91private:
92  ///@name Private member data
93  /// Column
94  int * column_;
95  /// Coefficients
96  double * coefficient_;
97  /// Useful to have number of columns about
98  int numberColumns_;
99  /// Number of coefficients
100  int numberCoefficients_;
101  //@}
102};
103
104#endif
Note: See TracBrowser for help on using the repository browser.