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

#include <model_solve_parameters.h>

Classes

struct  ObjectiveParameters
 Parameters for an individual objective in a multi-objective model. More...
 
struct  SolutionHint
 

Public Member Functions

absl::Status CheckModelStorage (const ModelStorage *expected_storage) const
 
ModelSolveParametersProto Proto () const
 

Static Public Member Functions

static ModelSolveParameters OnlyPrimalVariables ()
 
template<typename Collection >
static ModelSolveParameters OnlySomePrimalVariables (const Collection &variables)
 
static ModelSolveParameters OnlySomePrimalVariables (std::initializer_list< Variable > variables)
 
static absl::StatusOr< ModelSolveParametersFromProto (const Model &model, const ModelSolveParametersProto &proto)
 

Public Attributes

MapFilter< Variablevariable_values_filter
 
MapFilter< LinearConstraintdual_values_filter
 The filter that is applied to dual_values of DualSolution and DualRay.
 
MapFilter< QuadraticConstraintquadratic_dual_values_filter
 
MapFilter< Variablereduced_costs_filter
 The filter that is applied to reduced_costs of DualSolution and DualRay.
 
std::optional< Basisinitial_basis
 
std::vector< SolutionHintsolution_hints
 
VariableMap< int32_t > branching_priorities
 
ObjectiveMap< ObjectiveParametersobjective_parameters
 Parameters for individual objectives in a multi-objective model.
 
absl::flat_hash_set< LinearConstraintlazy_linear_constraints
 

Detailed Description

Parameters to control a single solve that are specific to the input model (see SolveParametersProto for model independent parameters).

Definition at line 43 of file model_solve_parameters.h.

Member Function Documentation

◆ CheckModelStorage()

absl::Status operations_research::math_opt::ModelSolveParameters::CheckModelStorage ( const ModelStorage * expected_storage) const

Returns a failure if the referenced variables and constraints do not belong to the input expected_storage (which must not be nullptr).

Definition at line 57 of file model_solve_parameters.cc.

◆ FromProto()

absl::StatusOr< ModelSolveParameters > operations_research::math_opt::ModelSolveParameters::FromProto ( const Model & model,
const ModelSolveParametersProto & proto )
static

Returns the ModelSolveParameters corresponding to this proto and the given model.

Definition at line 219 of file model_solve_parameters.cc.

◆ OnlyPrimalVariables()

ModelSolveParameters operations_research::math_opt::ModelSolveParameters::OnlyPrimalVariables ( )
static

Returns the parameters that empty DualSolution and DualRay, only keep the values of all variables in PrimalSolution and PrimalRay.

This is a shortcut method that is equivalent to setting the dual filters with MakeSkipAllFilter().

Definition at line 43 of file model_solve_parameters.cc.

◆ OnlySomePrimalVariables() [1/2]

template<typename Collection >
ModelSolveParameters operations_research::math_opt::ModelSolveParameters::OnlySomePrimalVariables ( const Collection & variables)
static

Returns the parameters that empty DualSolution and DualRay, only keep the values of the specified variables in PrimalSolution and PrimalRay.

The input Collection must be usable in a for-range loop with Variable values. This will be typically a std::vector<Variable> or and std::initializer_list<Variable> (see the other overload).

This is a shortcut method that is equivalent to setting the dual filters with MakeSkipAllFilter() and the variable_values_filter with MakeKeepKeysFilter(variables).

Example: std::vector<Variable> decision_vars = ...; const auto params = ModelSolveParameters::OnlySomePrimalVariables(decision_vars);

Inline functions implementations.

Definition at line 227 of file model_solve_parameters.h.

◆ OnlySomePrimalVariables() [2/2]

ModelSolveParameters operations_research::math_opt::ModelSolveParameters::OnlySomePrimalVariables ( std::initializer_list< Variable > variables)
static

Returns the parameters that empty DualSolution and DualRay, only keeping the values of the specified variables in PrimalSolution and PrimalRay.

See the other overload's documentation for details. This overload is needed since C++ can't guess the type when using an initializer list expression.

Example: const Variable a = ...; const Variable b = ...; const auto params = ModelSolveParameters::OnlySomePrimalVariables({a, b});

Definition at line 52 of file model_solve_parameters.cc.

◆ Proto()

ModelSolveParametersProto operations_research::math_opt::ModelSolveParameters::Proto ( ) const

Returns the proto equivalent of this object.

The caller should use CheckModelStorage() as this function does not check internal consistency of the referenced variables and constraints.

Todo
: b/315974557 - Return an error if a RepeatedField is too long.

Definition at line 170 of file model_solve_parameters.cc.

Member Data Documentation

◆ branching_priorities

VariableMap<int32_t> operations_research::math_opt::ModelSolveParameters::branching_priorities

Optional branching priorities. Variables with higher values will be branched on first. Variables for which priorities are not set get the solver's default priority (usually zero).

Definition at line 153 of file model_solve_parameters.h.

◆ dual_values_filter

MapFilter<LinearConstraint> operations_research::math_opt::ModelSolveParameters::dual_values_filter

The filter that is applied to dual_values of DualSolution and DualRay.

Definition at line 89 of file model_solve_parameters.h.

◆ initial_basis

std::optional<Basis> operations_research::math_opt::ModelSolveParameters::initial_basis

Optional initial basis for warm starting simplex LP solvers. If set, it is expected to be valid.

Definition at line 100 of file model_solve_parameters.h.

◆ lazy_linear_constraints

absl::flat_hash_set<LinearConstraint> operations_research::math_opt::ModelSolveParameters::lazy_linear_constraints

Optional lazy constraint annotations. Included linear constraints will be marked as "lazy" with supporting solvers, meaning that they will only be added to the working model as-needed as the solver runs.

Note
this an algorithmic hint that does not affect the model's feasible region; solvers not supporting these annotations will simply ignore it.

Definition at line 202 of file model_solve_parameters.h.

◆ objective_parameters

ObjectiveMap<ObjectiveParameters> operations_research::math_opt::ModelSolveParameters::objective_parameters

Parameters for individual objectives in a multi-objective model.

Definition at line 193 of file model_solve_parameters.h.

◆ quadratic_dual_values_filter

MapFilter<QuadraticConstraint> operations_research::math_opt::ModelSolveParameters::quadratic_dual_values_filter

The filter that is applied to quadratic_dual_values of DualSolution and DualRay.

Definition at line 93 of file model_solve_parameters.h.

◆ reduced_costs_filter

MapFilter<Variable> operations_research::math_opt::ModelSolveParameters::reduced_costs_filter

The filter that is applied to reduced_costs of DualSolution and DualRay.

Definition at line 96 of file model_solve_parameters.h.

◆ solution_hints

std::vector<SolutionHint> operations_research::math_opt::ModelSolveParameters::solution_hints

Optional solution hints. If the underlying solver only accepts a single hint, the first hint is used.

Definition at line 148 of file model_solve_parameters.h.

◆ variable_values_filter

MapFilter<Variable> operations_research::math_opt::ModelSolveParameters::variable_values_filter

The filter that is applied to variable_values of both PrimalSolution and PrimalRay.

Definition at line 86 of file model_solve_parameters.h.


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