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

- File List
- File Members

# /home/coin/SVN-release/Blis-0.92.0/Blis/src/BlisPseudo.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 Eclipse 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-2011, Lehigh University, Yan Xu, and Ted Ralphs.       *
    00021  * All Rights Reserved.                                                      *
    00022  *===========================================================================*/
    00023
    00024 #ifndef BlisPseudo_h_
    00025 #define BlisPseudo_h_
    00026
    00027 #include "CoinError.hpp"
    00028 #include "AlpsKnowledge.h"
    00029
    00030 //#############################################################################
    00031
    00032 class BlisPseudocost : public AlpsKnowledge
    00033 {
    00034 private:
    00036     double weight_;
    00037
    00039     double upCost_;
    00040
    00042     int upCount_;
    00043
    00045     double downCost_;
    00046
    00048     int downCount_;
    00049
    00054     double score_;
    00055
    00056 public:
    00058     BlisPseudocost() :
    00059         weight_(1.0),
    00060         upCost_(0.0),
    00061         upCount_(0),
    00062         downCost_(0.0),
    00063         downCount_(0),
    00064         score_(0.0)
    00065         {}
    00066
    00068         BlisPseudocost(double uc,
    00069                        int un,
    00070                        double dc,
    00071                    int dn,
    00072                    double s)
    00073         :
    00074         weight_(1.0),
    00075         upCost_(uc),
    00076         upCount_(un),
    00077         downCost_(dc),
    00078         downCount_(dn),
    00079         score_(s)
    00080         {}
    00081
    00083         BlisPseudocost(const BlisPseudocost& cost) {
    00084             weight_ = cost.weight_;
    00085             upCost_ = cost.upCost_;
    00086             upCount_ = cost.upCount_;
    00087             downCost_ = cost.downCost_;
    00088             downCount_ = cost.downCount_;
    00089             score_ = cost.score_;
    00090         }
    00091
    00093         BlisPseudocost& operator=(const BlisPseudocost& cost) {
    00094             weight_ = cost.weight_;
    00095             upCost_ = cost.upCost_;
    00096             upCount_ = cost.upCount_;
    00097             downCost_ = cost.downCost_;
    00098             downCount_ = cost.downCount_;
    00099             score_ = cost.score_;
    00100             return *this;
    00101         }
    00102
    00104     void setWeight(double w) {
    00105         if (w < 0.0 || w > 1.0) {
    00106             throw CoinError("weight is not in range [0,1]", "setWeight",
    00107                             "BlisPseudo");
    00108         }
    00109         weight_= w;
    00110     }
    00111
    00113     void update(const int dir,
    00114                 const double parentObjValue,
    00115                 const double objValue,
    00116                 const double solValue);
    00117
    00119     void update(const int dir,
    00120                 const double objDiff,
    00121                 const double solValue);
    00122
    00124     void update(double upCost,
    00125                 int upCount,
    00126                 double downCost,
    00127                 int downCount);
    00128
    00130     int getUpCount() { return upCount_; }
    00131
    00133     double getUpCost() { return upCost_; }
    00134
    00136     int getDownCount() { return downCount_; }
    00137
    00139     double getDownCost() { return downCost_; }
    00140
    00142     double getScore() { return score_; }
    00143
    00145     void setScore(double s) { score_ = s; }
    00146
    00148     AlpsReturnStatus encodeTo(AlpsEncoded *encoded) const;
    00149
    00151     AlpsReturnStatus decodeFrom(AlpsEncoded &encoded);
    00152
    00153     using AlpsKnowledge::encode ;
    00155     virtual AlpsEncoded* encode() const;
    00156
    00158     virtual AlpsKnowledge* decode(AlpsEncoded&) const;
    00159 };
    00160
    00161 #endif