source: branches/devel/Clp/src/ClpConstraint.hpp @ 997

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

for nonlinear

File size: 2.3 KB
Line 
1// Copyright (C) 2007, International Business Machines
2// Corporation and others.  All Rights Reserved.
3#ifndef ClpConstraint_H
4#define ClpConstraint_H
5
6
7//#############################################################################
8class ClpSimplex;
9class ClpModel;
10
11/** Constraint Abstract Base Class
12
13Abstract Base Class for describing a constraint or objective function
14
15*/
16class ClpConstraint  {
17 
18public:
19 
20  ///@name Stuff
21  //@{
22 
23  /** Fills gradient.  If Linear then solution may be NULL,
24      also returns value of function
25      If refresh is false then uses last solution
26      Uses model for scaling
27      Returns non-zero if gradient udefined at current solution
28  */
29  virtual int gradient(const ClpSimplex * model,
30                       const double * solution,
31                       double * gradient,
32                       double & functionValue ,
33                       bool refresh=true) const =0;
34  /// Resize constraint
35  virtual void resize(int newNumberColumns) = 0; 
36  /// Delete columns in  constraint
37  virtual void deleteSome(int numberToDelete, const int * which) = 0; 
38  /// Scale constraint
39  virtual void reallyScale(const double * columnScale) =0;
40  /** Given a zeroed array sets nonlinear columns to 1.
41      Returns number of nonlinear columns
42   */
43  virtual int markNonlinear(char * which) const = 0;
44  //@}
45 
46 
47  ///@name Constructors and destructors
48  //@{
49  /// Default Constructor
50  ClpConstraint(); 
51 
52  /// Copy constructor
53  ClpConstraint(const ClpConstraint &);
54 
55  /// Assignment operator
56  ClpConstraint & operator=(const ClpConstraint& rhs);
57 
58  /// Destructor
59  virtual ~ClpConstraint ();
60
61  /// Clone
62  virtual ClpConstraint * clone() const = 0;
63 
64  //@}
65
66  ///@name Other
67  //@{
68  /// Returns type, 0 linear, 1 nonlinear
69  inline int type()
70  { return type_;};
71  /// Row number (-1 is objective)
72  inline int rowNumber() const
73  {return rowNumber_;};
74 
75  /// Constraint function value
76  inline double functionValue () const
77  { return functionValue_;};
78  //@}
79
80  //---------------------------------------------------------------------------
81 
82protected:
83  ///@name Protected member data
84  //@{
85  /// Gradient at last evaluation
86  mutable double * lastGradient_;
87  /// Value of non-linear part of constraint
88  mutable double functionValue_;
89  /// Type of constraint - linear is 1
90  int type_;
91  /// Row number (-1 is objective)
92  int rowNumber_;
93  //@}
94};
95
96#endif
Note: See TracBrowser for help on using the repository browser.