Ignore:
Timestamp:
Nov 9, 2009 6:33:07 PM (10 years ago)
Author:
EdwinStraver
Message:

Changed formatting using AStyle -A4 -p

File:
1 edited

Legend:

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

    r1271 r1286  
    1212public:
    1313
    14   // Default Constructor
    15   CbcHeuristicLocal ();
    16 
    17   /* Constructor with model - assumed before cuts
    18      Initial version does not do Lps
    19   */
    20   CbcHeuristicLocal (CbcModel & model);
    21  
    22   // Copy constructor
    23   CbcHeuristicLocal ( const CbcHeuristicLocal &);
    24    
    25   // Destructor
    26   ~CbcHeuristicLocal ();
    27  
    28   /// Clone
    29   virtual CbcHeuristic * clone() const;
    30 
    31   /// Assignment operator
    32   CbcHeuristicLocal & operator=(const CbcHeuristicLocal& rhs);
    33 
    34   /// Create C++ lines to get to current state
    35   virtual void generateCpp( FILE * fp) ;
    36 
    37   /// Resets stuff if model changes
    38   virtual void resetModel(CbcModel * model);
    39 
    40   /// update model (This is needed if cliques update matrix etc)
    41   virtual void setModel(CbcModel * model);
    42  
    43   using CbcHeuristic::solution ;
    44   /** returns 0 if no solution, 1 if valid solution.
    45       Sets solution values if good, sets objective value (only if good)
    46       This is called after cuts have been added - so can not add cuts
    47       First tries setting a variable to better value.  If feasible then
    48       tries setting others.  If not feasible then tries swaps
    49 
    50       ********
    51 
    52       This first version does not do LP's and does swaps of two integer
    53       variables.  Later versions could do Lps.
    54   */
    55   virtual int solution(double & objectiveValue,
    56                        double * newSolution);
    57   /// This version fixes stuff and does IP
    58   int solutionFix(double & objectiveValue,
    59                   double * newSolution,
    60                   const int * keep);
    61 
    62   /// Sets type of search
    63   inline void setSearchType(int value)
    64   { swap_=value;}
    65   /// Used array so we can set
    66   inline int * used() const
    67   { return used_;}
     14    // Default Constructor
     15    CbcHeuristicLocal ();
     16
     17    /* Constructor with model - assumed before cuts
     18       Initial version does not do Lps
     19    */
     20    CbcHeuristicLocal (CbcModel & model);
     21
     22    // Copy constructor
     23    CbcHeuristicLocal ( const CbcHeuristicLocal &);
     24
     25    // Destructor
     26    ~CbcHeuristicLocal ();
     27
     28    /// Clone
     29    virtual CbcHeuristic * clone() const;
     30
     31    /// Assignment operator
     32    CbcHeuristicLocal & operator=(const CbcHeuristicLocal& rhs);
     33
     34    /// Create C++ lines to get to current state
     35    virtual void generateCpp( FILE * fp) ;
     36
     37    /// Resets stuff if model changes
     38    virtual void resetModel(CbcModel * model);
     39
     40    /// update model (This is needed if cliques update matrix etc)
     41    virtual void setModel(CbcModel * model);
     42
     43    using CbcHeuristic::solution ;
     44    /** returns 0 if no solution, 1 if valid solution.
     45        Sets solution values if good, sets objective value (only if good)
     46        This is called after cuts have been added - so can not add cuts
     47        First tries setting a variable to better value.  If feasible then
     48        tries setting others.  If not feasible then tries swaps
     49
     50        ********
     51
     52        This first version does not do LP's and does swaps of two integer
     53        variables.  Later versions could do Lps.
     54    */
     55    virtual int solution(double & objectiveValue,
     56                         double * newSolution);
     57    /// This version fixes stuff and does IP
     58    int solutionFix(double & objectiveValue,
     59                    double * newSolution,
     60                    const int * keep);
     61
     62    /// Sets type of search
     63    inline void setSearchType(int value) {
     64        swap_ = value;
     65    }
     66    /// Used array so we can set
     67    inline int * used() const {
     68        return used_;
     69    }
    6870
    6971protected:
    70   // Data
    71 
    72   // Original matrix by column
    73   CoinPackedMatrix matrix_;
    74 
    75   // Number of solutions so we only do after new solution
    76   int numberSolutions_;
    77   // Type of search 0=normal, 1=BAB
    78   int swap_;
    79   /// Whether a variable has been in a solution (also when)
    80   int * used_;
     72    // Data
     73
     74    // Original matrix by column
     75    CoinPackedMatrix matrix_;
     76
     77    // Number of solutions so we only do after new solution
     78    int numberSolutions_;
     79    // Type of search 0=normal, 1=BAB
     80    int swap_;
     81    /// Whether a variable has been in a solution (also when)
     82    int * used_;
    8183};
    8284
     
    9193public:
    9294
    93   // Default Constructor
    94   CbcHeuristicNaive ();
    95 
    96   /* Constructor with model - assumed before cuts
    97      Initial version does not do Lps
    98   */
    99   CbcHeuristicNaive (CbcModel & model);
    100  
    101   // Copy constructor
    102   CbcHeuristicNaive ( const CbcHeuristicNaive &);
    103    
    104   // Destructor
    105   ~CbcHeuristicNaive ();
    106  
    107   /// Clone
    108   virtual CbcHeuristic * clone() const;
    109 
    110   /// Assignment operator
    111   CbcHeuristicNaive & operator=(const CbcHeuristicNaive& rhs);
    112 
    113   /// Create C++ lines to get to current state
    114   virtual void generateCpp( FILE * fp) ;
    115 
    116   /// Resets stuff if model changes
    117   virtual void resetModel(CbcModel * model);
    118 
    119   /// update model (This is needed if cliques update matrix etc)
    120   virtual void setModel(CbcModel * model);
    121  
    122   using CbcHeuristic::solution ;
    123   /** returns 0 if no solution, 1 if valid solution.
    124       Sets solution values if good, sets objective value (only if good)
    125   */
    126   virtual int solution(double & objectiveValue,
    127                        double * newSolution);
    128 
    129   /// Sets large cost value
    130   inline void setLargeValue(double value)
    131   { large_=value;}
    132   /// Gets large cost value
    133   inline double largeValue() const
    134   { return large_;}
     95    // Default Constructor
     96    CbcHeuristicNaive ();
     97
     98    /* Constructor with model - assumed before cuts
     99       Initial version does not do Lps
     100    */
     101    CbcHeuristicNaive (CbcModel & model);
     102
     103    // Copy constructor
     104    CbcHeuristicNaive ( const CbcHeuristicNaive &);
     105
     106    // Destructor
     107    ~CbcHeuristicNaive ();
     108
     109    /// Clone
     110    virtual CbcHeuristic * clone() const;
     111
     112    /// Assignment operator
     113    CbcHeuristicNaive & operator=(const CbcHeuristicNaive& rhs);
     114
     115    /// Create C++ lines to get to current state
     116    virtual void generateCpp( FILE * fp) ;
     117
     118    /// Resets stuff if model changes
     119    virtual void resetModel(CbcModel * model);
     120
     121    /// update model (This is needed if cliques update matrix etc)
     122    virtual void setModel(CbcModel * model);
     123
     124    using CbcHeuristic::solution ;
     125    /** returns 0 if no solution, 1 if valid solution.
     126        Sets solution values if good, sets objective value (only if good)
     127    */
     128    virtual int solution(double & objectiveValue,
     129                         double * newSolution);
     130
     131    /// Sets large cost value
     132    inline void setLargeValue(double value) {
     133        large_ = value;
     134    }
     135    /// Gets large cost value
     136    inline double largeValue() const {
     137        return large_;
     138    }
    135139
    136140protected:
    137   /// Data
    138   /// Large value
    139   double large_;
     141    /// Data
     142    /// Large value
     143    double large_;
    140144};
    141145
     
    146150public:
    147151
    148   // Default Constructor
    149   CbcHeuristicCrossover ();
    150 
    151   /* Constructor with model - assumed before cuts
    152      Initial version does not do Lps
    153   */
    154   CbcHeuristicCrossover (CbcModel & model);
    155  
    156   // Copy constructor
    157   CbcHeuristicCrossover ( const CbcHeuristicCrossover &);
    158    
    159   // Destructor
    160   ~CbcHeuristicCrossover ();
    161  
    162   /// Clone
    163   virtual CbcHeuristic * clone() const;
    164 
    165   /// Assignment operator
    166   CbcHeuristicCrossover & operator=(const CbcHeuristicCrossover& rhs);
    167 
    168   /// Create C++ lines to get to current state
    169   virtual void generateCpp( FILE * fp) ;
    170 
    171   /// Resets stuff if model changes
    172   virtual void resetModel(CbcModel * model);
    173 
    174   /// update model (This is needed if cliques update matrix etc)
    175   virtual void setModel(CbcModel * model);
    176  
    177   using CbcHeuristic::solution ;
    178   /** returns 0 if no solution, 1 if valid solution.
    179       Fix variables if agree in useNumber_ solutions
    180       when_ 0 off, 1 only at new solutions, 2 also every now and then
    181       add 10 to make only if agree at lower bound
    182   */
    183   virtual int solution(double & objectiveValue,
    184                        double * newSolution);
    185 
    186   /// Sets number of solutions to use
    187   inline void setNumberSolutions(int value)
    188   {
    189     if (value>0&&value<=10)
    190       useNumber_=value;
    191   }
     152    // Default Constructor
     153    CbcHeuristicCrossover ();
     154
     155    /* Constructor with model - assumed before cuts
     156       Initial version does not do Lps
     157    */
     158    CbcHeuristicCrossover (CbcModel & model);
     159
     160    // Copy constructor
     161    CbcHeuristicCrossover ( const CbcHeuristicCrossover &);
     162
     163    // Destructor
     164    ~CbcHeuristicCrossover ();
     165
     166    /// Clone
     167    virtual CbcHeuristic * clone() const;
     168
     169    /// Assignment operator
     170    CbcHeuristicCrossover & operator=(const CbcHeuristicCrossover& rhs);
     171
     172    /// Create C++ lines to get to current state
     173    virtual void generateCpp( FILE * fp) ;
     174
     175    /// Resets stuff if model changes
     176    virtual void resetModel(CbcModel * model);
     177
     178    /// update model (This is needed if cliques update matrix etc)
     179    virtual void setModel(CbcModel * model);
     180
     181    using CbcHeuristic::solution ;
     182    /** returns 0 if no solution, 1 if valid solution.
     183        Fix variables if agree in useNumber_ solutions
     184        when_ 0 off, 1 only at new solutions, 2 also every now and then
     185        add 10 to make only if agree at lower bound
     186    */
     187    virtual int solution(double & objectiveValue,
     188                         double * newSolution);
     189
     190    /// Sets number of solutions to use
     191    inline void setNumberSolutions(int value) {
     192        if (value > 0 && value <= 10)
     193            useNumber_ = value;
     194    }
    192195
    193196protected:
    194   // Data
    195   /// Attempts
    196   std::vector <double> attempts_;
    197   /// Random numbers to stop same search happening
    198   double random_[10];
    199   /// Number of solutions so we only do after new solution
    200   int numberSolutions_;
    201   /// Number of solutions to use
    202   int useNumber_;
     197    // Data
     198    /// Attempts
     199    std::vector <double> attempts_;
     200    /// Random numbers to stop same search happening
     201    double random_[10];
     202    /// Number of solutions so we only do after new solution
     203    int numberSolutions_;
     204    /// Number of solutions to use
     205    int useNumber_;
    203206};
    204207
Note: See TracChangeset for help on using the changeset viewer.