/home/coin/SVN-release/CoinAll-1.1.0/Blis/src/BlisConstraint.h

Go to the documentation of this file.
00001 /*===========================================================================*
00002  * This file is part of the BiCePS Linear Integer Solver (BLIS).             *
00003  *                                                                           *
00004  * BLIS is distributed under the Common Public License as part of the        *
00005  * COIN-OR repository (http://www.coin-or.org).                              *
00006  *                                                                           *
00007  * Authors:                                                                  *
00008  *                                                                           *
00009  *          Yan Xu, Lehigh University                                        *
00010  *          Ted Ralphs, Lehigh University                                    *
00011  *                                                                           *
00012  * Conceptual Design:                                                        *
00013  *                                                                           *
00014  *          Yan Xu, Lehigh University                                        *
00015  *          Ted Ralphs, Lehigh University                                    *
00016  *          Laszlo Ladanyi, IBM T.J. Watson Research Center                  *
00017  *          Matthew Saltzman, Clemson University                             *
00018  *                                                                           * 
00019  *                                                                           *
00020  * Copyright (C) 2001-2007, Lehigh University, Yan Xu, and Ted Ralphs.       *
00021  * All Rights Reserved.                                                      *
00022  *===========================================================================*/
00023 
00024 #ifndef BlisConstraint_h_
00025 #define BlisConstraint_h_
00026 
00027 #include "BcpsObject.h"
00028 
00029 class OsiRowCut;
00030 
00031 //#############################################################################
00032 
00033 class BlisConstraint : public BcpsConstraint {
00034     
00035  protected:
00037     int size_;
00039     int *indices_;
00041     double *values_;
00042 
00043  public:
00044 
00046     BlisConstraint();
00047 
00049     BlisConstraint(int s, const int *ind, const double *val);
00050 
00052     BlisConstraint(double lbh, double ubh, double lbs, double ubs);
00053     
00055     BlisConstraint(double lbh, double ubh, double lbs, double ubs,
00056                    int size, const int *ind, const double *val);
00058     virtual ~BlisConstraint();
00059 
00061     BlisConstraint(const BlisConstraint & rhs);
00062     
00065     int getSize() const       { return size_; }
00066     int* getIndices() const   { return indices_; }
00067     double* getValues() const { return values_; }    
00072     void setData(int s, const int *ind, const double *val) {
00073         if (size_ < s) {
00074             delete [] indices_;
00075             delete [] values_;
00076             indices_ = new int [s];
00077             values_ = new double [s];
00078         }
00079         size_ = s;
00080         memcpy(indices_, ind, sizeof(int) * s);
00081         memcpy(values_, val, sizeof(double) * s);
00082     }
00085  protected:
00086 
00088     AlpsReturnStatus encodeBlis(AlpsEncoded *encoded);
00089 
00091     AlpsReturnStatus decodeBlis(AlpsEncoded &encoded);
00092             
00093  public:
00094 
00096     OsiRowCut *createOsiRowCut();
00097 
00099     virtual void hashing(BcpsModel *model=NULL);
00100 
00102     double violation(const double *lpSolution);
00103 
00104     using AlpsKnowledge::encode ;
00106     virtual AlpsReturnStatus encode(AlpsEncoded *encoded);
00107     
00109     virtual AlpsKnowledge* decode(AlpsEncoded& encoded) const;
00110 };
00111 
00112 //#############################################################################
00113 
00114 #endif

Generated on Sun Nov 14 14:06:30 2010 for Coin-All by  doxygen 1.4.7