/usr/include/coin/CbcHeuristicDive.hpp is in coinor-libcbc-dev 2.5.0-2.3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | /* $Id: CbcHeuristicDive.hpp 1252 2009-10-20 09:22:24Z stefan $ */
// Copyright (C) 2008, International Business Machines
// Corporation and others. All Rights Reserved.
#ifndef CbcHeuristicDive_H
#define CbcHeuristicDive_H
#include "CbcHeuristic.hpp"
struct PseudoReducedCost {
int var;
double pseudoRedCost;
};
/** Dive class
*/
class CbcHeuristicDive : public CbcHeuristic {
public:
// Default Constructor
CbcHeuristicDive ();
// Constructor with model - assumed before cuts
CbcHeuristicDive (CbcModel & model);
// Copy constructor
CbcHeuristicDive ( const CbcHeuristicDive &);
// Destructor
~CbcHeuristicDive ();
/// Clone
virtual CbcHeuristicDive * clone() const = 0;
/// Assignment operator
CbcHeuristicDive & operator=(const CbcHeuristicDive& rhs);
/// Create C++ lines to get to current state
virtual void generateCpp( FILE * ) {}
/// Create C++ lines to get to current state - does work for base class
void generateCpp( FILE * fp, const char * heuristic);
/// Resets stuff if model changes
virtual void resetModel(CbcModel * model);
/// update model (This is needed if cliques update matrix etc)
virtual void setModel(CbcModel * model);
// REMLOVE using CbcHeuristic::solution ;
/** returns 0 if no solution, 1 if valid solution
with better objective value than one passed in
Sets solution values if good, sets objective value (only if good)
This is called after cuts have been added - so can not add cuts
This does Fractional Diving
*/
virtual int solution(double & objectiveValue,
double * newSolution);
/// Validate model i.e. sets when_ to 0 if necessary (may be NULL)
virtual void validate();
/// Select candidate binary variables for fixing
void selectBinaryVariables();
/// Set percentage of integer variables to fix at bounds
void setPercentageToFix(double value) {
percentageToFix_ = value;
}
/// Set maximum number of iterations
void setMaxIterations(int value) {
maxIterations_ = value;
}
/// Set maximum number of simplex iterations
void setMaxSimplexIterations(int value) {
maxSimplexIterations_ = value;
}
/// Set maximum number of simplex iterations at root node
void setMaxSimplexIterationsAtRoot(int value) {
maxSimplexIterationsAtRoot_ = value;
}
/// Set maximum time allowed
void setMaxTime(double value) {
maxTime_ = value;
}
/// Tests if the heuristic can run
virtual bool canHeuristicRun();
/** Selects the next variable to branch on
Returns true if all the fractional variables can be trivially
rounded. Returns false, if there is at least one fractional variable
that is not trivially roundable. In this case, the bestColumn
returned will not be trivially roundable.
*/
virtual bool selectVariableToBranch(OsiSolverInterface* solver,
const double* newSolution,
int& bestColumn,
int& bestRound) = 0;
/** Initializes any data which is going to be used repeatedly
in selectVariableToBranch */
virtual void initializeData() {}
/// Perform reduced cost fixing on integer variables
int reducedCostFix (OsiSolverInterface* solver);
/// Fix other variables at bounds
virtual int fixOtherVariables(OsiSolverInterface * solver,
const double * solution,
PseudoReducedCost * candidate,
const double * random);
protected:
// Data
// Original matrix by column
CoinPackedMatrix matrix_;
// Original matrix by
CoinPackedMatrix matrixByRow_;
// Down locks
unsigned short * downLocks_;
// Up locks
unsigned short * upLocks_;
/// Extra down array (number Integers long)
double * downArray_;
/// Extra up array (number Integers long)
double * upArray_;
// Indexes of binary variables with 0 objective coefficient
// and in variable bound constraints
std::vector<int> binVarIndex_;
// Indexes of variable bound rows for each binary variable
std::vector<int> vbRowIndex_;
// Percentage of integer variables to fix at bounds
double percentageToFix_;
// Maximum number of major iterations
int maxIterations_;
// Maximum number of simplex iterations
int maxSimplexIterations_;
// Maximum number of simplex iterations at root node
int maxSimplexIterationsAtRoot_;
// Maximum time allowed
double maxTime_;
};
#endif
|