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

#include <solve_arguments.h>

Public Member Functions

absl::Status CheckModelStorageAndCallback (const ModelStorage *expected_storage) const
 

Public Attributes

SolveParameters parameters
 Model independent parameters, e.g. time limit.
 
ModelSolveParameters model_parameters
 Model dependent parameters, e.g. solution hint.
 
MessageCallback message_callback = nullptr
 
CallbackRegistration callback_registration
 
Callback callback = nullptr
 
const SolveInterrupterinterrupter = nullptr
 

Detailed Description

Arguments passed to Solve() and IncrementalSolver::Solve() to control the solve.

Definition at line 32 of file solve_arguments.h.

Member Function Documentation

◆ CheckModelStorageAndCallback()

absl::Status operations_research::math_opt::SolveArguments::CheckModelStorageAndCallback ( 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). Also returns a failure if callback events are registered but no callback is provided.

Definition at line 27 of file solve_arguments.cc.

Member Data Documentation

◆ callback

Callback operations_research::math_opt::SolveArguments::callback = nullptr

The optional callback for LP/MIP events.

The callback_registration parameters have to be set, in particular callback_registration.events.

See callback.h file comment for documentation on callbacks.

Definition at line 67 of file solve_arguments.h.

◆ callback_registration

CallbackRegistration operations_research::math_opt::SolveArguments::callback_registration

Callback registration parameters. Usually callback should also be set when these parameters are modified.

Definition at line 59 of file solve_arguments.h.

◆ interrupter

const SolveInterrupter* operations_research::math_opt::SolveArguments::interrupter = nullptr

An optional interrupter that the solver can use to interrupt the solve early.

Usage: auto interrupter = std::make_shared<SolveInterrupter>();

///< Use another thread to trigger the interrupter. RunInOtherThread([interrupter](){ ... wait for something that should interrupt the solve ... interrupter->Interrupt(); });

ASSIGN_OR_RETURN(const SolveResult result, Solve(model, SolverType::kGlop, { .interrupter = interrupter.get() });

Definition at line 85 of file solve_arguments.h.

◆ message_callback

MessageCallback operations_research::math_opt::SolveArguments::message_callback = nullptr

An optional callback for messages emitted by the solver.

When set it enables the solver messages and ignores the enable_output in solve parameters; messages are redirected to the callback and not printed on stdout/stderr/logs anymore.

See PrinterMessageCallback() for logging to stdout/stderr.

Usage:

///< To print messages to stdout with a prefix. ASSIGN_OR_RETURN( const SolveResult result, Solve(model, SolverType::kGlop, { .message_callback = PrinterMessageCallback(std::cout, "logs| "); });

Definition at line 55 of file solve_arguments.h.

◆ model_parameters

ModelSolveParameters operations_research::math_opt::SolveArguments::model_parameters

Model dependent parameters, e.g. solution hint.

Definition at line 37 of file solve_arguments.h.

◆ parameters

SolveParameters operations_research::math_opt::SolveArguments::parameters

Model independent parameters, e.g. time limit.

Definition at line 34 of file solve_arguments.h.


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