Changeset 1591 for Alps/stable/1.3/Alps


Ignore:
Timestamp:
Jul 25, 2011 2:30:00 PM (8 years ago)
Author:
tkr
Message:

Print out depth at which best solution was found properly

Location:
Alps/stable/1.3/Alps/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • Alps/stable/1.3/Alps/src/AlpsKnowledgeBroker.cpp

    r1502 r1591  
    4545    nodeLeftNum_(0),
    4646    treeDepth_(0),
    47     bestSolDepth_(INT_MAX),
    4847    bestSolNode_(-1),
    4948    peakMemory_(0.0),
  • Alps/stable/1.3/Alps/src/AlpsKnowledgeBroker.h

    r1502 r1591  
    135135    int treeDepth_;
    136136
    137     /** The depth of the node that with best solution. */
    138     int bestSolDepth_;
    139 
    140137    /** The number of nodes pocessed to find the solution. */
    141138    int bestSolNode_;
     
    295292    int getTreeDepth() { return treeDepth_; }
    296293
    297     /** Get best solution depth */
    298     int getBestSolDepth() { return bestSolDepth_; }
    299 
    300     /** Set best solution depth */
    301     void setBestSolDepth(int depth) { bestSolDepth_ = depth; }
    302 
    303294    /** Set peak memory usage. */
    304295    void setPeakMemory(double size) { peakMemory_ = size; }
  • Alps/stable/1.3/Alps/src/AlpsKnowledgeBrokerSerial.cpp

    r1546 r1591  
    281281
    282282        if (hasKnowledge(AlpsKnowledgeTypeSolution)) {
    283             messageHandler()->message(ALPS_S_FINAL_SOL, messages())
    284                 << getBestQuality() << bestSolDepth_ << CoinMessageEol;
     283            AlpsSolution *solution = dynamic_cast<AlpsSolution *>
     284               (getBestKnowledge(AlpsKnowledgeTypeSolution).first);
     285            if (solution->getDepth() >= 0){
     286               messageHandler()->message(ALPS_S_FINAL_SOL_WD, messages())
     287                  << getBestKnowledge(AlpsKnowledgeTypeSolution).second <<
     288                  solution->getDepth() << CoinMessageEol;
     289            }else{
     290               messageHandler()->message(ALPS_S_FINAL_SOL, messages())
     291                  << getBestKnowledge(AlpsKnowledgeTypeSolution).second <<
     292                  CoinMessageEol;
     293            }
    285294        }
    286295        else {
  • Alps/stable/1.3/Alps/src/AlpsMessage.cpp

    r1546 r1591  
    9696    {ALPS_T_NODE_LIMIT,204, 1, "Reached node limit. %d nodes processed, %d nodes left"},
    9797    {ALPS_T_NO_MEMORY,206, 1, "Out of memory. %d nodes processed, %d nodes left"},
    98     {ALPS_T_OPTIMAL,208, 1, "Found an optimal solution. %d nodes processed, %d nodes left"},
     98    {ALPS_T_OPTIMAL,208, 1, "Search completed. %d nodes processed, %d nodes left"},
    9999    {ALPS_T_SOL_LIMIT,210, 1, "Reached solution limit. %d nodes processed, %d nodes left"},
    100100    {ALPS_T_TIME_LIMIT,230, 1, "Reached time limit. %d nodes processed, %d nodes left"},
    101     {ALPS_S_NODE_COUNT, 240, 1, "Processed %d nodes, has %d nodes, best relaxed %g, best feasible %g"},
     101    {ALPS_S_NODE_COUNT, 240, 1, "Processed: %d, Queued: %d, Best node: %g, Best solution: %g"},
    102102    {ALPS_S_SEARCH_START, 250, 1, "Starting search ..."},
    103103    {ALPS_S_SEARCH_SOL, 255, 3, "Process %d found a better solution %g"},
    104     {ALPS_S_FINAL_SOL, 260, 1, "Quality of the best solution found: %g ; depth %d"},
     104    {ALPS_S_FINAL_SOL, 260, 1, "Best solution found had quality %g"},
     105    {ALPS_S_FINAL_SOL_WD, 261, 1, "Best solution found had quality %g and was found at depth %d"},
    105106    {ALPS_S_FINAL_NO_SOL, 264, 1, "No solution found"},
    106107    {ALPS_S_FINAL_NODE_PROCESSED, 267, 1, "Number of nodes processed: %d"},
  • Alps/stable/1.3/Alps/src/AlpsMessage.h

    r1546 r1591  
    9797    ALPS_S_SEARCH_SOL,
    9898    ALPS_S_FINAL_SOL,
     99    ALPS_S_FINAL_SOL_WD,
    99100    ALPS_S_FINAL_NO_SOL,
    100101    ALPS_S_FINAL_NODE_PROCESSED,
  • Alps/stable/1.3/Alps/src/AlpsSolution.h

    r1502 r1591  
    3838    AlpsSolution(const AlpsSolution&);
    3939    AlpsSolution& operator=(const AlpsSolution&);
     40
     41    /** The index of the node where the solution was found. */
     42    int index_;
    4043   
     44    /** The depth of the node where the solution was found. */
     45    int depth_;
     46
    4147 public:
    4248   
    4349    /** Default constructor. */
    44     AlpsSolution() { setType(AlpsKnowledgeTypeSolution); }
     50    AlpsSolution() :
     51       index_(-1),
     52       depth_(-1)
     53    {
     54       setType(AlpsKnowledgeTypeSolution);
     55    }
     56
     57    /** Constructor to set index and depth. */
     58    AlpsSolution(const AlpsNodeIndex_t i, const int d) :
     59       index_(i),
     60       depth_(d)
     61    {
     62       setType(AlpsKnowledgeTypeSolution);
     63    }
    4564
    4665    /** Destructor. */
    4766    virtual ~AlpsSolution() {}
     67
     68    /** Get index where solution was found */
     69    AlpsNodeIndex_t getIndex() { return index_; }
     70   
     71    /** Set index where solution was found */
     72    void setIndex(const AlpsNodeIndex_t i) { index_ = i; }
     73   
     74    /** Get depth where solution was found */
     75    int getDepth() { return depth_; }
     76   
     77    /** Set depth where solution was found */
     78    void setDepth(const int d) { depth_ = d; }
    4879   
    4980    /** Print out the solution.*/
Note: See TracChangeset for help on using the changeset viewer.