20#ifndef OR_TOOLS_LINEAR_SOLVER_SCIP_CALLBACK_H_
21#define OR_TOOLS_LINEAR_SOLVER_SCIP_CALLBACK_H_
30#include "scip/type_scip.h"
31#include "scip/type_sol.h"
103 bool is_pseudo_solution_;
113template <
typename Constra
int>
157template <
typename Constra
int>
175template <
typename Constra
intData>
178 const std::string& constraint_name,
179 const ConstraintData* constraint_data,
202template <
typename Constra
intData>
207 : handler_(handler) {}
211 void* constraint_data)
override {
213 context, *
static_cast<ConstraintData*
>(constraint_data));
218 void* constraint_data)
override {
220 context, *
static_cast<ConstraintData*
>(constraint_data));
224 void* constraint_data)
override {
226 context, *
static_cast<ConstraintData*
>(constraint_data));
230 void* constraint_data)
override {
232 context, *
static_cast<ConstraintData*
>(constraint_data));
241 std::unique_ptr<ScipCallbackRunner> runner,
SCIP* scip);
244 const std::string& constraint_name,
245 void* constraint_data,
250template <
typename Constra
intData>
260template <
typename Constra
intData>
263 const std::string& constraint_name,
264 const ConstraintData* constraint_data,
268 static_cast<void*
>(
const_cast<ConstraintData*
>(constraint_data)),
The class for variables of a Mathematical Programming (MP) model.
int64_t CurrentNodeId() const
double VariableValue(const MPVariable *variable) const
ScipConstraintHandlerContext(SCIP *scip, SCIP_SOL *solution, bool is_pseudo_solution)
A value of nullptr for solution means to use the current LP solution.
int64_t NumNodesProcessed() const
bool is_pseudo_solution() const
virtual ~ScipConstraintHandler()
ScipConstraintHandler(const ScipConstraintHandlerDescription &description)
const ScipConstraintHandlerDescription & description() const
virtual bool FractionalSolutionFeasible(const ScipConstraintHandlerContext &context, const Constraint &constraint)
Returns true if no constraints are violated.
virtual std::vector< CallbackRangeConstraint > SeparateIntegerSolution(const ScipConstraintHandlerContext &context, const Constraint &constraint)
virtual std::vector< CallbackRangeConstraint > SeparateFractionalSolution(const ScipConstraintHandlerContext &context, const Constraint &constraint)=0
virtual bool IntegerSolutionFeasible(const ScipConstraintHandlerContext &context, const Constraint &constraint)
This MUST find a violated constraint if one exists.
std::vector< CallbackRangeConstraint > SeparateIntegerSolution(const ScipConstraintHandlerContext &context, void *constraint_data) override
ScipCallbackRunnerImpl(ScipConstraintHandler< ConstraintData > *handler)
std::vector< CallbackRangeConstraint > SeparateFractionalSolution(const ScipConstraintHandlerContext &context, void *constraint_data) override
bool FractionalSolutionFeasible(const ScipConstraintHandlerContext &context, void *constraint_data) override
bool IntegerSolutionFeasible(const ScipConstraintHandlerContext &context, void *constraint_data) override
virtual std::vector< CallbackRangeConstraint > SeparateFractionalSolution(const ScipConstraintHandlerContext &context, void *constraint)=0
virtual std::vector< CallbackRangeConstraint > SeparateIntegerSolution(const ScipConstraintHandlerContext &context, void *constraint)=0
virtual bool IntegerSolutionFeasible(const ScipConstraintHandlerContext &context, void *constraint)=0
virtual bool FractionalSolutionFeasible(const ScipConstraintHandlerContext &context, void *constraint)=0
virtual ~ScipCallbackRunner()
GurobiMPCallbackContext * context
void AddConstraintHandlerImpl(const ScipConstraintHandlerDescription &description, std::unique_ptr< ScipCallbackRunner > runner, SCIP *scip)
void AddCallbackConstraintImpl(SCIP *scip, const std::string &handler_name, const std::string &constraint_name, void *constraint_data, const ScipCallbackConstraintOptions &options)
In SWIG mode, we don't want anything besides these top-level includes.
void AddCallbackConstraint(SCIP *scip, ScipConstraintHandler< ConstraintData > *handler, const std::string &constraint_name, const ConstraintData *constraint_data, const ScipCallbackConstraintOptions &options)
constraint_data is not owned but held.
void RegisterConstraintHandler(ScipConstraintHandler< Constraint > *handler, SCIP *scip)
handler is not owned but held.
int feasibility_check_priority
bool needs_constraints
See CONSHDLR_NEEDSCONS in SCIP documentation above.
std::string name
See CONSHDLR_NAME in SCIP documentation above.
int eager_frequency
See CONSHDLR_EAGERFREQ in SCIP documentation above.
std::string description
See CONSHDLR_DESC in SCIP documentation above.
int separation_frequency
See CONSHDLR_SEPAFREQ in the SCIP documentation above.