Ignore:
Timestamp:
Nov 25, 2009 12:58:07 PM (10 years ago)
Author:
EdwinStraver
Message:

Broke up CbcCompareActual?.cpp into CbcCompareDepth?, CbcCompareDefault?, CbcCompareObjective? and CbcCompareEstimate?.
Carved CbcCutModifier? and CbcCutSubsetModifier? out of CbcCutGenerator?.
Updated spreadsheets.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/sandbox/Cbc/src/CbcCompareActual.hpp

    r1290 r1314  
    44#ifndef CbcCompareActual_H
    55#define CbcCompareActual_H
    6 
    7 
    8 //#############################################################################
    9 /*  These are alternative strategies for node traversal.
    10     They can take data etc for fine tuning
    11 
    12     At present the node list is stored as a heap and the "test"
    13     comparison function returns true if node y is better than node x.
    14 
    15 */
    166#include "CbcNode.hpp"
    177#include "CbcCompareBase.hpp"
    188#include "CbcCompare.hpp"
    19 
    20 class CbcModel;
    21 // This is default before first solution
    22 class CbcCompareDepth : public CbcCompareBase {
    23 public:
    24     // Default Constructor
    25     CbcCompareDepth () ;
    26 
    27     ~CbcCompareDepth();
    28     // Copy constructor
    29     CbcCompareDepth ( const CbcCompareDepth &rhs);
    30 
    31     // Assignment operator
    32     CbcCompareDepth & operator=( const CbcCompareDepth& rhs);
    33 
    34     /// Clone
    35     virtual CbcCompareBase * clone() const;
    36     /// Create C++ lines to get to current state
    37     virtual void generateCpp( FILE * fp);
    38 
    39     // This returns true if the depth of node y is greater than depth of node x
    40     virtual bool test (CbcNode * x, CbcNode * y);
    41 };
    42 class CbcCompareObjective  : public CbcCompareBase {
    43 public:
    44     // Default Constructor
    45     CbcCompareObjective ();
    46 
    47     virtual ~CbcCompareObjective();
    48     // Copy constructor
    49     CbcCompareObjective ( const CbcCompareObjective &rhs);
    50 
    51     // Assignment operator
    52     CbcCompareObjective & operator=( const CbcCompareObjective& rhs);
    53 
    54     /// Clone
    55     virtual CbcCompareBase * clone() const;
    56     /// Create C++ lines to get to current state
    57     virtual void generateCpp( FILE * fp);
    58 
    59     /* This returns true if objective value of node y is less than
    60        objective value of node x */
    61     virtual bool test (CbcNode * x, CbcNode * y);
    62 };
    63 /* This is an example of a more complex rule with data
    64    It is default after first solution
    65    If weight is 0.0 then it is computed to hit first solution
    66    less 5%
    67 */
    68 class CbcCompareDefault  : public CbcCompareBase {
    69 public:
    70     // Default Constructor
    71     CbcCompareDefault () ;
    72     // Constructor with weight
    73     CbcCompareDefault (double weight);
    74 
    75     // Copy constructor
    76     CbcCompareDefault ( const CbcCompareDefault &rhs);
    77 
    78     // Assignment operator
    79     CbcCompareDefault & operator=( const CbcCompareDefault& rhs);
    80 
    81     /// Clone
    82     virtual CbcCompareBase * clone() const;
    83     /// Create C++ lines to get to current state
    84     virtual void generateCpp( FILE * fp);
    85 
    86     ~CbcCompareDefault() ;
    87     /* This returns true if weighted value of node y is less than
    88        weighted value of node x */
    89     virtual bool test (CbcNode * x, CbcNode * y) ;
    90 
    91     using CbcCompareBase::newSolution ;
    92     // This allows method to change behavior as it is called
    93     // after each solution
    94     virtual void newSolution(CbcModel * model,
    95                              double objectiveAtContinuous,
    96                              int numberInfeasibilitiesAtContinuous) ;
    97     // This allows method to change behavior
    98     // Return true if want tree re-sorted
    99     virtual bool every1000Nodes(CbcModel * model, int numberNodes);
    100 
    101     /* if weight == -1.0 then fewest infeasibilities (before solution)
    102        if -2.0 then do breadth first just for first 1000 nodes
    103        if -3.0 then depth first before solution
    104     */
    105     inline double getWeight() const {
    106         return weight_;
    107     }
    108     inline void setWeight(double weight) {
    109         weight_ = weight;
    110     }
    111     /// Cutoff
    112     inline double getCutoff() const {
    113         return cutoff_;
    114     }
    115     inline void setCutoff(double cutoff) {
    116         cutoff_ = cutoff;
    117     }
    118     /// Best possible solution
    119     inline double getBestPossible() const {
    120         return bestPossible_;
    121     }
    122     inline void setBestPossible(double bestPossible) {
    123         bestPossible_ = bestPossible;
    124     }
    125     // Depth above which want to explore first
    126     inline void setBreadthDepth(int value) {
    127         breadthDepth_ = value;
    128     }
    129 protected:
    130     // Weight for each infeasibility
    131     double weight_;
    132     // Weight for each infeasibility - computed from solution
    133     double saveWeight_;
    134     /// Cutoff
    135     double cutoff_;
    136     /// Best possible solution
    137     double bestPossible_;
    138     // Number of solutions
    139     int numberSolutions_;
    140     // Tree size (at last check)
    141     int treeSize_;
    142     // Depth above which want to explore first
    143     int breadthDepth_;
    144 };
    145 
    146 /* This is when rounding is being done
    147 */
    148 class CbcCompareEstimate  : public CbcCompareBase {
    149 public:
    150     // Default Constructor
    151     CbcCompareEstimate () ;
    152     ~CbcCompareEstimate() ;
    153     // Copy constructor
    154     CbcCompareEstimate ( const CbcCompareEstimate &rhs);
    155 
    156     // Assignment operator
    157     CbcCompareEstimate & operator=( const CbcCompareEstimate& rhs);
    158 
    159     /// Clone
    160     virtual CbcCompareBase * clone() const;
    161     /// Create C++ lines to get to current state
    162     virtual void generateCpp( FILE * fp);
    163 
    164     virtual bool test (CbcNode * x, CbcNode * y) ;
    165 };
    166 
     9#include "CbcCompareDepth.hpp"
     10#include "CbcCompareDefault.hpp"
    16711#endif
Note: See TracChangeset for help on using the changeset viewer.