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

#include <model_solve_parameters.h>

Public Member Functions

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

Static Public Member Functions

static absl::StatusOr< SolutionHintFromProto (const Model &model, const SolutionHintProto &hint_proto)
 

Public Attributes

VariableMap< double > variable_values
 
LinearConstraintMap< double > dual_values
 

Detailed Description

A suggested starting solution for the solver.

MIP solvers generally only want primal information (variable_values), while LP solvers want both primal and dual information (dual_values).

Many MIP solvers can work with: (1) partial solutions that do not specify all variables or (2) infeasible solutions. In these cases, solvers typically solve a sub-MIP to complete/correct the hint.

How the hint is used by the solver, if at all, is highly dependent on the solver, the problem type, and the algorithm used. The most reliable way to ensure your hint has an effect is to read the underlying solvers logs with and without the hint.

Simplex-based LP solvers typically prefer an initial basis to a solution hint (they need to crossover to convert the hint to a basic feasible solution otherwise).

Definition at line 119 of file model_solve_parameters.h.

Member Function Documentation

◆ CheckModelStorage()

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

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

Definition at line 99 of file model_solve_parameters.cc.

◆ FromProto()

absl::StatusOr< ModelSolveParameters::SolutionHint > operations_research::math_opt::ModelSolveParameters::SolutionHint::FromProto ( const Model & model,
const SolutionHintProto & hint_proto )
static

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

This can be useful when loading a hint from another format, e.g. with MPModelProtoSolutionHintToMathOptHint().

Definition at line 124 of file model_solve_parameters.cc.

◆ Proto()

SolutionHintProto operations_research::math_opt::ModelSolveParameters::SolutionHint::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.

Definition at line 116 of file model_solve_parameters.cc.

Member Data Documentation

◆ dual_values

LinearConstraintMap<double> operations_research::math_opt::ModelSolveParameters::SolutionHint::dual_values

Values should be finite and not NaN (otherwise, Solve() will return a Status error).

Definition at line 126 of file model_solve_parameters.h.

◆ variable_values

VariableMap<double> operations_research::math_opt::ModelSolveParameters::SolutionHint::variable_values

Values should be finite and not NaN (otherwise, Solve() will return a Status error).

Definition at line 122 of file model_solve_parameters.h.


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