source: stable/2.4/Cbc/src/ClpConstraintAmpl.hpp @ 1271

Last change on this file since 1271 was 1271, checked in by forrest, 10 years ago

Creating new stable branch 2.4 from trunk (rev 1270)

File size: 2.7 KB
Line 
1/* $Id: ClpConstraintAmpl.hpp 1173 2009-06-04 09:44:10Z forrest $ */
2// Copyright (C) 2007, International Business Machines
3// Corporation and others.  All Rights Reserved.
4#ifndef ClpConstraintAmpl_H
5#define ClpConstraintAmpl_H
6
7#include "ClpConstraint.hpp"
8
9//#############################################################################
10
11/** Ampl Constraint Class
12
13*/
14
15class ClpConstraintAmpl : public ClpConstraint {
16 
17public:
18 
19  ///@name Stuff
20  //@{
21 
22 
23  /** Fills gradient.  If Ampl then solution may be NULL,
24      also returns true value of function and offset so we can use x not deltaX in constraint
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                       double & offset,
34                       bool useScaling=false,
35                       bool refresh=true) const ;
36  /// Resize constraint
37  virtual void resize(int newNumberColumns) ; 
38  /// Delete columns in  constraint
39  virtual void deleteSome(int numberToDelete, const int * which) ; 
40  /// Scale constraint
41  virtual void reallyScale(const double * columnScale) ;
42  /** Given a zeroed array sets nonampl columns to 1.
43      Returns number of nonampl columns
44   */
45  virtual int markNonlinear(char * which) const ;
46  /** Given a zeroed array sets possible nonzero coefficients to 1.
47      Returns number of nonzeros
48   */
49  virtual int markNonzero(char * which) const;
50  /// Say we have new primal solution - so may need to recompute
51  virtual void newXValues() ;
52  //@}
53 
54 
55  ///@name Constructors and destructors
56  //@{
57  /// Default Constructor
58  ClpConstraintAmpl(); 
59 
60  /// Constructor from ampl
61  ClpConstraintAmpl(int row, void * amplInfo);
62 
63  /** Copy constructor .
64  */
65  ClpConstraintAmpl(const ClpConstraintAmpl & rhs);
66
67  /// Assignment operator
68  ClpConstraintAmpl & operator=(const ClpConstraintAmpl& rhs);
69 
70  /// Destructor
71  virtual ~ClpConstraintAmpl ();
72
73  /// Clone
74  virtual ClpConstraint * clone() const;
75  //@}
76  ///@name Gets and sets
77  //@{
78  /// Number of coefficients
79  virtual int numberCoefficients() const;
80  /// Columns
81  inline const int * column() const
82  { return column_;}
83  /// Coefficients
84  inline const double * coefficient() const
85  { return coefficient_;}
86  //@}
87
88  //---------------------------------------------------------------------------
89 
90private:
91  ///@name Private member data
92  /// Ampl info
93  void * amplInfo_;
94  /// Column
95  int * column_;
96  /// Coefficients
97  double * coefficient_;
98  /// Number of coefficients in gradient
99  int numberCoefficients_;
100  //@}
101};
102
103#endif
Note: See TracBrowser for help on using the repository browser.