CoinBuild.hpp
Go to the documentation of this file.
1 /* $Id: CoinBuild.hpp 1215 2009-11-05 11:03:04Z forrest $ */
2 // Copyright (C) 2005, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 #ifndef CoinBuild_H
5 #define CoinBuild_H
6 
7 
8 #include "CoinPragma.hpp"
9 #include "CoinFinite.hpp"
10 
11 
24 class CoinBuild {
25 
26 public:
29  void addRow(int numberInRow, const int * columns,
31  const double * elements, double rowLower=-COIN_DBL_MAX,
32  double rowUpper=COIN_DBL_MAX);
34  void addColumn(int numberInColumn, const int * rows,
35  const double * elements,
36  double columnLower=0.0,
37  double columnUpper=COIN_DBL_MAX, double objectiveValue=0.0);
39  inline void addCol(int numberInColumn, const int * rows,
40  const double * elements,
41  double columnLower=0.0,
42  double columnUpper=COIN_DBL_MAX, double objectiveValue=0.0)
43  { addColumn(numberInColumn, rows, elements, columnLower, columnUpper, objectiveValue);}
45  inline int numberRows() const
46  { return (type_==0) ? numberItems_ : numberOther_;}
48  inline int numberColumns() const
49  { return (type_==1) ? numberItems_ : numberOther_;}
52  { return numberElements_;}
55  int row(int whichRow, double & rowLower, double & rowUpper,
56  const int * & indices, const double * & elements) const;
60  int currentRow(double & rowLower, double & rowUpper,
61  const int * & indices, const double * & elements) const;
63  void setCurrentRow(int whichRow);
65  int currentRow() const;
68  int column(int whichColumn,
69  double & columnLower, double & columnUpper,double & objectiveValue,
70  const int * & indices, const double * & elements) const;
74  int currentColumn( double & columnLower, double & columnUpper,double & objectiveValue,
75  const int * & indices, const double * & elements) const;
77  void setCurrentColumn(int whichColumn);
79  int currentColumn() const;
81  inline int type() const
82  { return type_;}
84 
85 
89  CoinBuild();
91  CoinBuild(int type);
93  ~CoinBuild();
95 
99  CoinBuild(const CoinBuild&);
101  CoinBuild& operator=(const CoinBuild&);
103 private:
105  void setMutableCurrent(int which) const;
107  void addItem(int numberInItem, const int * indices,
108  const double * elements,
109  double itemLower,
110  double itemUpper, double objectiveValue);
113  int item(int whichItem,
114  double & itemLower, double & itemUpper,double & objectiveValue,
115  const int * & indices, const double * & elements) const;
119  int currentItem( double & itemLower, double & itemUpper,double & objectiveValue,
120  const int * & indices, const double * & elements) const;
122  void setCurrentItem(int whichItem);
124  int currentItem() const;
125 
126 private:
129  int numberItems_;
136  mutable double * currentItem_;
138  double * firstItem_;
140  double * lastItem_;
142  int type_;
144 };
145 
146 #endif