Bonmin 1.8.9
Loading...
Searching...
No Matches
BonHeuristicDive.hpp
Go to the documentation of this file.
1// Copyright (C) 2007, International Business Machines Corporation and others.
2// All Rights Reserved.
3// This code is published under the Eclipse Public License.
4//
5// Authors :
6// Joao P. Goncalves, International Business Machines Corporation
7//
8// Date : November 12, 2007
9
10#ifndef BonHeuristicDive_HPP
11#define BonHeuristicDive_HPP
13#include "BonBonminSetup.hpp"
14#include "CbcHeuristic.hpp"
15
16namespace Bonmin
17{
18 class HeuristicDive : public CbcHeuristic
19 {
20 public:
23
26
29
32
35
37 virtual CbcHeuristic * clone() const = 0;
38
40 virtual void resetModel(CbcModel * model){
41 setModel(model);
42 }
43
45 virtual void setSetup(BonminSetup * setup){
46 setup_ = setup;
47 // Initialize(setup_->options());
48 }
49
51 void setPercentageToFix(double value)
52 { percentageToFix_ = value; }
53
55 virtual int solution(double &solutionValue, double *betterSolution);
56
58 virtual void setInternalVariables(TMINLP2TNLP* minlp) = 0;
59
61
64 const vector<int> & integerColumns,
65 const double* newSolution,
66 int& bestColumn,
67 int& bestRound) = 0;
68
69 protected:
72
75
76 private:
78 int howOften_;
79
80 };
81
83 bool isNlpFeasible(TMINLP2TNLP* minlp, const double primalTolerance);
84
86 void adjustPrimalTolerance(TMINLP2TNLP* minlp, double & primalTolerance);
87}
88#endif
virtual void setSetup(BonminSetup *setup)
Change setup used for heuristic.
virtual void resetModel(CbcModel *model)
Resets stuff if model changes.
HeuristicDive(const HeuristicDive &copy)
Copy constructor.
HeuristicDive & operator=(const HeuristicDive &rhs)
Assignment operator.
virtual int solution(double &solutionValue, double *betterSolution)
Performs heuristic.
HeuristicDive()
Default constructor.
virtual CbcHeuristic * clone() const =0
Clone.
virtual void setInternalVariables(TMINLP2TNLP *minlp)=0
sets internal variables
void setPercentageToFix(double value)
Set percentage of integer variables to fix at bounds.
BonminSetup * setup_
Setup to use for local searches (will make copies).
double percentageToFix_
Percentage of integer variables to fix at bounds.
HeuristicDive(BonminSetup *setup)
Constructor with setup.
virtual void selectVariableToBranch(TMINLP2TNLP *minlp, const vector< int > &integerColumns, const double *newSolution, int &bestColumn, int &bestRound)=0
Selects the next variable to branch on.
This is an adapter class that converts a TMINLP to a TNLP to be solved by Ipopt.
A small wrap around std::vector to give easy access to array for interfacing with fortran code.
Definition BonTypes.hpp:9
(C) Copyright International Business Machines Corporation 2007
bool isNlpFeasible(TMINLP2TNLP *minlp, const double primalTolerance)
checks if the NLP relaxation of the problem is feasible
void adjustPrimalTolerance(TMINLP2TNLP *minlp, double &primalTolerance)
Adjusts the primalTolerance in case some of the constraints are violated.