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

Last change on this file since 1525 was 1525, checked in by mjs, 10 years ago

Formatted .cpp, .hpp, .c, .h files with "astyle -A4 -p". This matches the formatting used in the grand CBC reorganization.

  • Property svn:keywords set to Id
File size: 3.1 KB
Line 
1/* $Id: ClpConstraintLinear.hpp 1525 2010-02-26 17:27:59Z mjs $ */
2// Copyright (C) 2007, International Business Machines
3// Corporation and others.  All Rights Reserved.
4#ifndef ClpConstraintLinear_H
5#define ClpConstraintLinear_H
6
7#include "ClpConstraint.hpp"
8
9//#############################################################################
10
11/** Linear Constraint Class
12
13*/
14
15class ClpConstraintLinear : public ClpConstraint {
16
17public:
18
19     ///@name Stuff
20     //@{
21
22
23     /** Fills gradient.  If Linear 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 nonlinear columns to 1.
43         Returns number of nonlinear 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     //@}
51
52
53     ///@name Constructors and destructors
54     //@{
55     /// Default Constructor
56     ClpConstraintLinear();
57
58     /// Constructor from constraint
59     ClpConstraintLinear(int row, int numberCoefficients, int numberColumns,
60                         const int * column, const double * element);
61
62     /** Copy constructor .
63     */
64     ClpConstraintLinear(const ClpConstraintLinear & rhs);
65
66     /// Assignment operator
67     ClpConstraintLinear & operator=(const ClpConstraintLinear& rhs);
68
69     /// Destructor
70     virtual ~ClpConstraintLinear ();
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 linear constraint
80     inline int numberColumns() const {
81          return numberColumns_;
82     }
83     /// Columns
84     inline const int * column() const {
85          return column_;
86     }
87     /// Coefficients
88     inline const double * coefficient() const {
89          return coefficient_;
90     }
91     //@}
92
93     //---------------------------------------------------------------------------
94
95private:
96     ///@name Private member data
97     /// Column
98     int * column_;
99     /// Coefficients
100     double * coefficient_;
101     /// Useful to have number of columns about
102     int numberColumns_;
103     /// Number of coefficients
104     int numberCoefficients_;
105     //@}
106};
107
108#endif
Note: See TracBrowser for help on using the repository browser.