CoinUtils 2.10.15

- 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 1416 2011-04-17 09:57:29Z stefan $ */
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
10 #include "CoinPragma.hpp"
11 #include "CoinTypes.hpp"
12 #include "CoinFinite.hpp"
13
14
27 class CoinBuild {
28
29 public:
32 void addRow(int numberInRow, const int * columns,
34 const double * elements, double rowLower=-COIN_DBL_MAX,
35 double rowUpper=COIN_DBL_MAX);
37 void addColumn(int numberInColumn, const int * rows,
38 const double * elements,
39 double columnLower=0.0,
40 double columnUpper=COIN_DBL_MAX, double objectiveValue=0.0);
42 inline void addCol(int numberInColumn, const int * rows,
43 const double * elements,
44 double columnLower=0.0,
45 double columnUpper=COIN_DBL_MAX, double objectiveValue=0.0)
46 { addColumn(numberInColumn, rows, elements, columnLower, columnUpper, objectiveValue);}
48 inline int numberRows() const
49 { return (type_==0) ? numberItems_ : numberOther_;}
51 inline int numberColumns() const
52 { return (type_==1) ? numberItems_ : numberOther_;}
54 inline CoinBigIndex numberElements() const
55 { return numberElements_;}
58 int row(int whichRow, double & rowLower, double & rowUpper,
59 const int * & indices, const double * & elements) const;
63 int currentRow(double & rowLower, double & rowUpper,
64 const int * & indices, const double * & elements) const;
66 void setCurrentRow(int whichRow);
68 int currentRow() const;
71 int column(int whichColumn,
72 double & columnLower, double & columnUpper,double & objectiveValue,
73 const int * & indices, const double * & elements) const;
77 int currentColumn( double & columnLower, double & columnUpper,double & objectiveValue,
78 const int * & indices, const double * & elements) const;
80 void setCurrentColumn(int whichColumn);
82 int currentColumn() const;
84 inline int type() const
85 { return type_;}
87
88
92 CoinBuild();
94 CoinBuild(int type);
96 ~CoinBuild();
98
102 CoinBuild(const CoinBuild&);
104 CoinBuild& operator=(const CoinBuild&);
106 private:
108 void setMutableCurrent(int which) const;
110 void addItem(int numberInItem, const int * indices,
111 const double * elements,
112 double itemLower,
113 double itemUpper, double objectiveValue);
116 int item(int whichItem,
117 double & itemLower, double & itemUpper,double & objectiveValue,
118 const int * & indices, const double * & elements) const;
122 int currentItem( double & itemLower, double & itemUpper,double & objectiveValue,
123 const int * & indices, const double * & elements) const;
125 void setCurrentItem(int whichItem);
127 int currentItem() const;
128
129 private:
132 int numberItems_;
135 int numberOther_;
137 CoinBigIndex numberElements_;
139 mutable double * currentItem_;
141 double * firstItem_;
143 double * lastItem_;
145 int type_;
147 };
148
149 #endif
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:42
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:133
CoinBuild::numberElements
CoinBigIndex numberElements() const
Return number of elements.
Definition: CoinBuild.hpp:54
CoinBuild::numberOther_
int numberOther_
Current number of other dimension i.e. Columns if addRow (i.e. max)
Definition: CoinBuild.hpp:135
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:137
CoinBuild::numberColumns
int numberColumns() const
Return number of columns or maximum found so far.
Definition: CoinBuild.hpp:51
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:145
CoinBuild::currentItem
int currentItem() const
Returns current item number.
CoinBigIndex
int CoinBigIndex
Definition: Coin_C_defines.h:105
CoinBuild::lastItem_
double * lastItem_
Last item pointer.
Definition: CoinBuild.hpp:143
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:84
CoinBuild::~CoinBuild
~CoinBuild()
Destructor.
CoinBuild::firstItem_
double * firstItem_
First item pointer.
Definition: CoinBuild.hpp:141
COIN_DBL_MAX
const double COIN_DBL_MAX
Definition: CoinFinite.hpp:18
CoinBuild::currentItem_
double * currentItem_
Current item pointer.
Definition: CoinBuild.hpp:139
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:27