CoinUtils trunk
CoinBuild.hpp
Go to the documentation of this file.
00001 /* $Id$ */
00002 // Copyright (C) 2005, International Business Machines
00003 // Corporation and others.  All Rights Reserved.
00004 // This code is licensed under the terms of the Eclipse Public License (EPL).
00005 
00006 #ifndef CoinBuild_H
00007 #define CoinBuild_H
00008 
00009 
00010 #include "CoinPragma.hpp"
00011 #include "CoinTypes.hpp"
00012 #include "CoinFinite.hpp"
00013 
00014 
00027 class CoinBuild {
00028   
00029 public:
00032 
00033    void addRow(int numberInRow, const int * columns,
00034                const double * elements, double rowLower=-COIN_DBL_MAX, 
00035               double rowUpper=COIN_DBL_MAX);
00037    void addColumn(int numberInColumn, const int * rows,
00038                   const double * elements, 
00039                   double columnLower=0.0, 
00040                   double columnUpper=COIN_DBL_MAX, double objectiveValue=0.0);
00042    inline void addCol(int numberInColumn, const int * rows,
00043                   const double * elements, 
00044                   double columnLower=0.0, 
00045                   double columnUpper=COIN_DBL_MAX, double objectiveValue=0.0)
00046   { addColumn(numberInColumn, rows, elements, columnLower, columnUpper, objectiveValue);}
00048   inline int numberRows() const
00049   { return (type_==0) ? numberItems_ : numberOther_;}
00051   inline int numberColumns() const
00052   { return (type_==1) ? numberItems_ : numberOther_;}
00054   inline CoinBigIndex numberElements() const
00055   { return numberElements_;}
00058   int row(int whichRow, double & rowLower, double & rowUpper,
00059           const int * & indices, const double * & elements) const;
00063   int currentRow(double & rowLower, double & rowUpper,
00064           const int * & indices, const double * & elements) const;
00066   void setCurrentRow(int whichRow);
00068   int currentRow() const;
00071   int column(int whichColumn, 
00072              double & columnLower, double & columnUpper,double & objectiveValue,
00073              const int * & indices, const double * & elements) const;
00077   int currentColumn( double & columnLower, double & columnUpper,double & objectiveValue,
00078           const int * & indices, const double * & elements) const;
00080   void setCurrentColumn(int whichColumn);
00082   int currentColumn() const;
00084   inline int type() const
00085   { return type_;}
00087 
00088 
00092    CoinBuild();
00094    CoinBuild(int type);
00096    ~CoinBuild();
00098 
00102    CoinBuild(const CoinBuild&);
00104    CoinBuild& operator=(const CoinBuild&);
00106 private:
00108   void setMutableCurrent(int which) const;
00110    void addItem(int numberInItem, const int * indices,
00111                   const double * elements, 
00112                   double itemLower, 
00113                   double itemUpper, double objectiveValue);
00116   int item(int whichItem, 
00117              double & itemLower, double & itemUpper,double & objectiveValue,
00118              const int * & indices, const double * & elements) const;
00122   int currentItem( double & itemLower, double & itemUpper,double & objectiveValue,
00123           const int * & indices, const double * & elements) const;
00125   void setCurrentItem(int whichItem);
00127   int currentItem() const;
00128    
00129 private:
00132 
00133   int numberItems_;
00135   int numberOther_;
00137   CoinBigIndex numberElements_;
00139   mutable double * currentItem_;
00141   double * firstItem_;
00143   double * lastItem_;
00145   int type_;
00147 };
00148 
00149 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines