Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::GScipConstraintHandlerContext Class Reference

#include <gscip_constraint_handler.h>

Public Member Functions

 GScipConstraintHandlerContext (GScip *gscip, const GScipCallbackStats *stats, SCIP_CONSHDLR *current_handler, SCIP_SOL *current_solution)
 
GScip * gscip ()
 
double VariableValue (SCIP_VAR *variable) const
 
absl::StatusOr< GScipCallbackResultAddCut (const GScipLinearRange &range, const std::string &name, const GScipCutOptions &options=GScipCutOptions())
 
absl::Status AddLazyLinearConstraint (const GScipLinearRange &range, const std::string &name, const GScipLazyConstraintOptions &options=GScipLazyConstraintOptions())
 
absl::Status SetLocalVarLb (SCIP_VAR *var, double value)
 
absl::Status SetLocalVarUb (SCIP_VAR *var, double value)
 
absl::Status SetGlobalVarLb (SCIP_VAR *var, double value)
 
absl::Status SetGlobalVarUb (SCIP_VAR *var, double value)
 
double LocalVarLb (SCIP_VAR *var) const
 
double LocalVarUb (SCIP_VAR *var) const
 
double GlobalVarLb (SCIP_VAR *var) const
 
double GlobalVarUb (SCIP_VAR *var) const
 
const GScipCallbackStatsstats () const
 

Detailed Description

Interface to the callback context and underlying problem. Supports adding cuts and lazy constraints, and setting bounds. Prefer to use this context to query information instead of a raw SCIP pointer. Passed by value.

Todo
(user): Add support for branching.

Definition at line 176 of file gscip_constraint_handler.h.

Constructor & Destructor Documentation

◆ GScipConstraintHandlerContext()

operations_research::GScipConstraintHandlerContext::GScipConstraintHandlerContext ( GScip * gscip,
const GScipCallbackStats * stats,
SCIP_CONSHDLR * current_handler,
SCIP_SOL * current_solution )
inline

Construct the context for the given handler. Following SCIP convention, if SCIP_SOL is nullptr, then the current solution from the LP is used.

Definition at line 180 of file gscip_constraint_handler.h.

Member Function Documentation

◆ AddCut()

absl::StatusOr< GScipCallbackResult > operations_research::GScipConstraintHandlerContext::AddCut ( const GScipLinearRange & range,
const std::string & name,
const GScipCutOptions & options = GScipCutOptions() )

Adds a cut (row) to the SCIP separation storage.

If this is called and succeeds, the callback result must be the one returned or a higher priority result. The result returned is either kCutOff (SCIP_CUTOFF) if SCIP determined that the cut results in infeasibility based on local bounds, or kSeparated (SCIP_SEPARATED) otherwise.

Definition at line 311 of file gscip_constraint_handler.cc.

◆ AddLazyLinearConstraint()

absl::Status operations_research::GScipConstraintHandlerContext::AddLazyLinearConstraint ( const GScipLinearRange & range,
const std::string & name,
const GScipLazyConstraintOptions & options = GScipLazyConstraintOptions() )

Adds a lazy constraint as a SCIP linear constraint. This is similar to adding it as a row (and it would be valid to add a lazy constraint with AddCut and proper options), but it is treated as a higher-level object and may affect other portions of SCIP such as propagation. This is a thin wrapper on GScip::AddLinearConstraint() with different defaults.

If this is called and succeeds, the callback result must be kConsAdded (equivalent to SCIP_CONSADDED) or a higher priority result.

Definition at line 336 of file gscip_constraint_handler.cc.

◆ GlobalVarLb()

double operations_research::GScipConstraintHandlerContext::GlobalVarLb ( SCIP_VAR * var) const

Definition at line 352 of file gscip_constraint_handler.cc.

◆ GlobalVarUb()

double operations_research::GScipConstraintHandlerContext::GlobalVarUb ( SCIP_VAR * var) const

Definition at line 355 of file gscip_constraint_handler.cc.

◆ gscip()

GScip * operations_research::GScipConstraintHandlerContext::gscip ( )
inline

Definition at line 188 of file gscip_constraint_handler.h.

◆ LocalVarLb()

double operations_research::GScipConstraintHandlerContext::LocalVarLb ( SCIP_VAR * var) const

Definition at line 346 of file gscip_constraint_handler.cc.

◆ LocalVarUb()

double operations_research::GScipConstraintHandlerContext::LocalVarUb ( SCIP_VAR * var) const

Definition at line 349 of file gscip_constraint_handler.cc.

◆ SetGlobalVarLb()

absl::Status operations_research::GScipConstraintHandlerContext::SetGlobalVarLb ( SCIP_VAR * var,
double value )

Definition at line 369 of file gscip_constraint_handler.cc.

◆ SetGlobalVarUb()

absl::Status operations_research::GScipConstraintHandlerContext::SetGlobalVarUb ( SCIP_VAR * var,
double value )

Definition at line 373 of file gscip_constraint_handler.cc.

◆ SetLocalVarLb()

absl::Status operations_research::GScipConstraintHandlerContext::SetLocalVarLb ( SCIP_VAR * var,
double value )

The functions below set variable bounds. If they are used to cut off a solution, then the callback result must be kReducedDomain (SCIP_REDUCEDDOM) or a higher priority result.

Definition at line 359 of file gscip_constraint_handler.cc.

◆ SetLocalVarUb()

absl::Status operations_research::GScipConstraintHandlerContext::SetLocalVarUb ( SCIP_VAR * var,
double value )

Definition at line 364 of file gscip_constraint_handler.cc.

◆ stats()

const GScipCallbackStats & operations_research::GScipConstraintHandlerContext::stats ( ) const
inline

Definition at line 231 of file gscip_constraint_handler.h.

◆ VariableValue()

double operations_research::GScipConstraintHandlerContext::VariableValue ( SCIP_VAR * variable) const

Returns the current solution value of a variable. This may be for a given solution (e.g. in CONS_SEPASOL) or the current LP/pseudosolution (e.g. in CONS_SEPALP). Equivalent to calling SCIPgetSolVal.

Definition at line 307 of file gscip_constraint_handler.cc.


The documentation for this class was generated from the following files: