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

Last change on this file since 2030 was 1665, checked in by lou, 9 years ago

Add EPL license notice in src.

  • Property svn:keywords set to Id
File size: 3.1 KB
Line 
1/* $Id: ClpConstraintLinear.hpp 1665 2011-01-04 17:55:54Z forrest $ */
2// Copyright (C) 2007, International Business Machines
3// Corporation and others.  All Rights Reserved.
4// This code is licensed under the terms of the Eclipse Public License (EPL).
5
6#ifndef ClpConstraintLinear_H
7#define ClpConstraintLinear_H
8
9#include "ClpConstraint.hpp"
10
11//#############################################################################
12
13/** Linear Constraint Class
14
15*/
16
17class ClpConstraintLinear : public ClpConstraint {
18
19public:
20
21     ///@name Stuff
22     //@{
23
24
25     /** Fills gradient.  If Linear then solution may be NULL,
26         also returns true value of function and offset so we can use x not deltaX in constraint
27         If refresh is false then uses last solution
28         Uses model for scaling
29         Returns non-zero if gradient udefined at current solution
30     */
31     virtual int gradient(const ClpSimplex * model,
32                          const double * solution,
33                          double * gradient,
34                          double & functionValue ,
35                          double & offset,
36                          bool useScaling = false,
37                          bool refresh = true) const ;
38     /// Resize constraint
39     virtual void resize(int newNumberColumns) ;
40     /// Delete columns in  constraint
41     virtual void deleteSome(int numberToDelete, const int * which) ;
42     /// Scale constraint
43     virtual void reallyScale(const double * columnScale) ;
44     /** Given a zeroed array sets nonlinear columns to 1.
45         Returns number of nonlinear columns
46      */
47     virtual int markNonlinear(char * which) const ;
48     /** Given a zeroed array sets possible nonzero coefficients to 1.
49         Returns number of nonzeros
50      */
51     virtual int markNonzero(char * which) const;
52     //@}
53
54
55     ///@name Constructors and destructors
56     //@{
57     /// Default Constructor
58     ClpConstraintLinear();
59
60     /// Constructor from constraint
61     ClpConstraintLinear(int row, int numberCoefficients, int numberColumns,
62                         const int * column, const double * element);
63
64     /** Copy constructor .
65     */
66     ClpConstraintLinear(const ClpConstraintLinear & rhs);
67
68     /// Assignment operator
69     ClpConstraintLinear & operator=(const ClpConstraintLinear& rhs);
70
71     /// Destructor
72     virtual ~ClpConstraintLinear ();
73
74     /// Clone
75     virtual ClpConstraint * clone() const;
76     //@}
77     ///@name Gets and sets
78     //@{
79     /// Number of coefficients
80     virtual int numberCoefficients() const;
81     /// Number of columns in linear constraint
82     inline int numberColumns() const {
83          return numberColumns_;
84     }
85     /// Columns
86     inline const int * column() const {
87          return column_;
88     }
89     /// Coefficients
90     inline const double * coefficient() const {
91          return coefficient_;
92     }
93     //@}
94
95     //---------------------------------------------------------------------------
96
97private:
98     ///@name Private member data
99     /// Column
100     int * column_;
101     /// Coefficients
102     double * coefficient_;
103     /// Useful to have number of columns about
104     int numberColumns_;
105     /// Number of coefficients
106     int numberCoefficients_;
107     //@}
108};
109
110#endif
Note: See TracBrowser for help on using the repository browser.