source: branches/devel/Cbc/src/ClpConstraintAmpl.hpp @ 642

Last change on this file since 642 was 642, checked in by forrest, 12 years ago

update branches/devel for threads

File size: 2.6 KB
Line 
1// Copyright (C) 2007, International Business Machines
2// Corporation and others.  All Rights Reserved.
3#ifndef ClpConstraintAmpl_H
4#define ClpConstraintAmpl_H
5
6#include "ClpConstraint.hpp"
7
8//#############################################################################
9
10/** Ampl Constraint Class
11
12*/
13
14class ClpConstraintAmpl : public ClpConstraint {
15 
16public:
17 
18  ///@name Stuff
19  //@{
20 
21 
22  /** Fills gradient.  If Ampl 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 nonampl columns to 1.
42      Returns number of nonampl 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  /// Say we have new primal solution - so may need to recompute
50  virtual void newXValues() ;
51  //@}
52 
53 
54  ///@name Constructors and destructors
55  //@{
56  /// Default Constructor
57  ClpConstraintAmpl(); 
58 
59  /// Constructor from ampl
60  ClpConstraintAmpl(int row, void * amplInfo);
61 
62  /** Copy constructor .
63  */
64  ClpConstraintAmpl(const ClpConstraintAmpl & rhs);
65
66  /// Assignment operator
67  ClpConstraintAmpl & operator=(const ClpConstraintAmpl& rhs);
68 
69  /// Destructor
70  virtual ~ClpConstraintAmpl ();
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  /// Columns
80  inline const int * column() const
81  { return column_;};
82  /// Coefficients
83  inline const double * coefficient() const
84  { return coefficient_;};
85  //@}
86
87  //---------------------------------------------------------------------------
88 
89private:
90  ///@name Private member data
91  /// Ampl info
92  void * amplInfo_;
93  /// Column
94  int * column_;
95  /// Coefficients
96  double * coefficient_;
97  /// Number of coefficients in gradient
98  int numberCoefficients_;
99  //@}
100};
101
102#endif
Note: See TracBrowser for help on using the repository browser.