Cgl 0.60.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CoinBuild.hpp
Go to the documentation of this file.
1 /* $Id: CoinBuild.hpp 2083 2019-01-06 19:38:09Z unxusr $ */
2 // Copyright (C) 2005, 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 CoinBuild_H
7 #define CoinBuild_H
8
9 #include "CoinPragma.hpp"
10 #include "CoinTypes.hpp"
11 #include "CoinFinite.hpp"
12
25 class CoinBuild {
26
27 public:
30 void addRow(int numberInRow, const int *columns,
32 const double *elements, double rowLower = -COIN_DBL_MAX,
33 double rowUpper = COIN_DBL_MAX);
35 void addColumn(int numberInColumn, const int *rows,
36 const double *elements,
37 double columnLower = 0.0,
38 double columnUpper = COIN_DBL_MAX, double objectiveValue = 0.0);
40 inline void addCol(int numberInColumn, const int *rows,
41 const double *elements,
42 double columnLower = 0.0,
43 double columnUpper = COIN_DBL_MAX, double objectiveValue = 0.0)
44 {
45 addColumn(numberInColumn, rows, elements, columnLower, columnUpper, objectiveValue);
46 }
48 inline int numberRows() const
49 {
50 return (type_ == 0) ? numberItems_ : numberOther_;
51 }
53 inline int numberColumns() const
54 {
55 return (type_ == 1) ? numberItems_ : numberOther_;
56 }
58 inline CoinBigIndex numberElements() const
59 {
60 return numberElements_;
61 }
64 int row(int whichRow, double &rowLower, double &rowUpper,
65 const int *&indices, const double *&elements) const;
69 int currentRow(double &rowLower, double &rowUpper,
70 const int *&indices, const double *&elements) const;
72 void setCurrentRow(int whichRow);
74 int currentRow() const;
77 int column(int whichColumn,
78 double &columnLower, double &columnUpper, double &objectiveValue,
79 const int *&indices, const double *&elements) const;
83 int currentColumn(double &columnLower, double &columnUpper, double &objectiveValue,
84 const int *&indices, const double *&elements) const;
86 void setCurrentColumn(int whichColumn);
88 int currentColumn() const;
90 inline int type() const
91 {
92 return type_;
93 }
95
99 CoinBuild();
101 CoinBuild(int type);
103 ~CoinBuild();
105
109 CoinBuild(const CoinBuild &);
111 CoinBuild &operator=(const CoinBuild &);
113 private:
115 void setMutableCurrent(int which) const;
117 void addItem(int numberInItem, const int *indices,
118 const double *elements,
119 double itemLower,
120 double itemUpper, double objectiveValue);
123 int item(int whichItem,
124 double &itemLower, double &itemUpper, double &objectiveValue,
125 const int *&indices, const double *&elements) const;
129 int currentItem(double &itemLower, double &itemUpper, double &objectiveValue,
130 const int *&indices, const double *&elements) const;
132 void setCurrentItem(int whichItem);
134 int currentItem() const;
135
136 private:
139 int numberItems_;
142 int numberOther_;
144 CoinBigIndex numberElements_;
146 mutable double *currentItem_;
148 double *firstItem_;
150 double *lastItem_;
152 int type_;
154 };
155
156 #endif
157
158 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
159 */
CoinBuild::setCurrentColumn
void setCurrentColumn(int whichColumn)
Set current column.
CoinBuild::addRow
void addRow(int numberInRow, const int *columns, const double *elements, double rowLower=-COIN_DBL_MAX, double rowUpper=COIN_DBL_MAX)
add a row
CoinBuild::addCol
void addCol(int numberInColumn, const int *rows, const double *elements, double columnLower=0.0, double columnUpper=COIN_DBL_MAX, double objectiveValue=0.0)
add a column
Definition: CoinBuild.hpp:40
CoinTypes.hpp
CoinBuild::operator=
CoinBuild & operator=(const CoinBuild &)
=
CoinBuild::setCurrentRow
void setCurrentRow(int whichRow)
Set current row.
CoinBuild::addItem
void addItem(int numberInItem, const int *indices, const double *elements, double itemLower, double itemUpper, double objectiveValue)
add a item
CoinBuild::column
int column(int whichColumn, double &columnLower, double &columnUpper, double &objectiveValue, const int *&indices, const double *&elements) const
Returns number of elements in a column and information in column.
CoinBuild::currentRow
int currentRow() const
Returns current row number.
CoinBuild::currentColumn
int currentColumn() const
Returns current column number.
CoinBuild::setMutableCurrent
void setMutableCurrent(int which) const
Set current.
CoinBuild::addColumn
void addColumn(int numberInColumn, const int *rows, const double *elements, double columnLower=0.0, double columnUpper=COIN_DBL_MAX, double objectiveValue=0.0)
add a column
CoinFinite.hpp
CoinBuild::numberItems_
int numberItems_
Current number of items.
Definition: CoinBuild.hpp:140
CoinBuild::numberElements
CoinBigIndex numberElements() const
Return number of elements.
Definition: CoinBuild.hpp:58
CoinBuild::numberOther_
int numberOther_
Current number of other dimension i.e. Columns if addRow (i.e. max)
Definition: CoinBuild.hpp:142
CoinPragma.hpp
CoinBuild::numberRows
int numberRows() const
Return number of rows or maximum found so far.
Definition: CoinBuild.hpp:48
CoinBuild::numberElements_
CoinBigIndex numberElements_
Current number of elements.
Definition: CoinBuild.hpp:144
CoinBuild::numberColumns
int numberColumns() const
Return number of columns or maximum found so far.
Definition: CoinBuild.hpp:53
CoinBuild::row
int row(int whichRow, double &rowLower, double &rowUpper, const int *&indices, const double *&elements) const
Returns number of elements in a row and information in row.
CoinBuild::setCurrentItem
void setCurrentItem(int whichItem)
Set current item.
CoinBuild::type_
int type_
Type of build - 0 for row, 1 for column, -1 unset.
Definition: CoinBuild.hpp:152
CoinBuild::currentItem
int currentItem() const
Returns current item number.
CoinBigIndex
int CoinBigIndex
Definition: Coin_C_defines.h:136
CoinBuild::lastItem_
double * lastItem_
Last item pointer.
Definition: CoinBuild.hpp:150
CoinBuild::item
int item(int whichItem, double &itemLower, double &itemUpper, double &objectiveValue, const int *&indices, const double *&elements) const
Returns number of elements in a item and information in item.
CoinBuild::type
int type() const
Returns type.
Definition: CoinBuild.hpp:90
CoinBuild::~CoinBuild
~CoinBuild()
Destructor.
CoinBuild::firstItem_
double * firstItem_
First item pointer.
Definition: CoinBuild.hpp:148
COIN_DBL_MAX
const double COIN_DBL_MAX
Definition: CoinFinite.hpp:18
CoinBuild::currentItem_
double * currentItem_
Current item pointer.
Definition: CoinBuild.hpp:146
CoinBuild::CoinBuild
CoinBuild()
Default constructor.
CoinBuild
In many cases it is natural to build a model by adding one row at a time.
Definition: CoinBuild.hpp:25