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

Incremental solve of a model. More...

#include <solve_impl.h>

Inheritance diagram for operations_research::math_opt::internal::IncrementalSolverImpl:
operations_research::math_opt::IncrementalSolver

Public Member Functions

absl::StatusOr< SolveResult > Solve (const SolveArguments &arguments) override
 
absl::StatusOr< ComputeInfeasibleSubsystemResultComputeInfeasibleSubsystem (const ComputeInfeasibleSubsystemArguments &arguments) override
 
absl::StatusOr< UpdateResultUpdate () override
 
absl::StatusOr< SolveResult > SolveWithoutUpdate (const SolveArguments &arguments) const override
 
absl::StatusOr< ComputeInfeasibleSubsystemResultComputeInfeasibleSubsystemWithoutUpdate (const ComputeInfeasibleSubsystemArguments &arguments) const override
 
SolverType solver_type () const override
 Returns the underlying solver used.
 
- Public Member Functions inherited from operations_research::math_opt::IncrementalSolver
 IncrementalSolver ()=default
 
 IncrementalSolver (const IncrementalSolver &)=delete
 
IncrementalSolveroperator= (const IncrementalSolver &)=delete
 
virtual ~IncrementalSolver ()=default
 
absl::StatusOr< SolveResult > Solve ()
 
absl::StatusOr< ComputeInfeasibleSubsystemResultComputeInfeasibleSubsystem ()
 
absl::StatusOr< SolveResult > SolveWithoutUpdate () const
 
absl::StatusOr< ComputeInfeasibleSubsystemResultComputeInfeasibleSubsystemWithoutUpdate () const
 

Static Public Member Functions

static absl::StatusOr< std::unique_ptr< IncrementalSolverImpl > > New (BaseSolverFactory solver_factory, Model *model, SolverType solver_type, const SolveInterrupter *user_canceller, bool remove_names)
 

Detailed Description

Incremental solve of a model.

Definition at line 75 of file solve_impl.h.

Member Function Documentation

◆ ComputeInfeasibleSubsystem()

absl::StatusOr< ComputeInfeasibleSubsystemResult > operations_research::math_opt::internal::IncrementalSolverImpl::ComputeInfeasibleSubsystem ( const ComputeInfeasibleSubsystemArguments & arguments)
overridevirtual

Updates the underlying solver with latest model changes and runs the computation.

Same as Solve() but compute the infeasible subsystem.

Todo
: b/260337466 - Add permanent errors and concurrency protection.

Implements operations_research::math_opt::IncrementalSolver.

Definition at line 201 of file solve_impl.cc.

◆ ComputeInfeasibleSubsystemWithoutUpdate()

absl::StatusOr< ComputeInfeasibleSubsystemResult > operations_research::math_opt::internal::IncrementalSolverImpl::ComputeInfeasibleSubsystemWithoutUpdate ( const ComputeInfeasibleSubsystemArguments & arguments) const
overridevirtual

Same as ComputeInfeasibleSubsystem() but does not update the underlying solver with the latest changes to the model.

This is an advanced API, most users should use ComputeInfeasibleSubsystem().

Todo
: b/260337466 - Add permanent errors and concurrency protection.

Implements operations_research::math_opt::IncrementalSolver.

Definition at line 243 of file solve_impl.cc.

◆ New()

absl::StatusOr< std::unique_ptr< IncrementalSolverImpl > > operations_research::math_opt::internal::IncrementalSolverImpl::New ( BaseSolverFactory solver_factory,
Model * model,
SolverType solver_type,
const SolveInterrupter * user_canceller,
bool remove_names )
static

Creates a new incremental solve.

The user_canceller parameter is optional.

Definition at line 152 of file solve_impl.cc.

◆ Solve()

absl::StatusOr< SolveResult > operations_research::math_opt::internal::IncrementalSolverImpl::Solve ( const SolveArguments & arguments)
overridevirtual

Updates the underlying solver with latest model changes and runs the solve.

A Status error will be returned if inputs are invalid or there is an unexpected failure in an underlying solver or for some internal math_opt errors. Otherwise, check SolveResult::termination.reason to see if an optimal solution was found.

Memory model: the returned SolveResult owns its own memory (for solutions, solve stats, etc.), EXPECT for a pointer back to the model. As a result:

  • Keep the model alive to access SolveResult,
  • Avoid unnecessarily copying SolveResult,
  • The result is generally accessible after mutating this, but some care is needed if variables or linear constraints are added or deleted.

See callback.h for documentation on arguments.callback and arguments.callback_registration.

Todo
: b/260337466 - Add permanent errors and concurrency protection.

Implements operations_research::math_opt::IncrementalSolver.

Definition at line 193 of file solve_impl.cc.

◆ solver_type()

SolverType operations_research::math_opt::internal::IncrementalSolverImpl::solver_type ( ) const
inlineoverridevirtual

Returns the underlying solver used.

Implements operations_research::math_opt::IncrementalSolver.

Definition at line 98 of file solve_impl.h.

◆ SolveWithoutUpdate()

absl::StatusOr< SolveResult > operations_research::math_opt::internal::IncrementalSolverImpl::SolveWithoutUpdate ( const SolveArguments & arguments) const
overridevirtual

Same as Solve() but does not update the underlying solver with the latest changes to the model.

This is an advanced API, most users should use Solve().

Todo
: b/260337466 - Add permanent errors and concurrency protection.

Implements operations_research::math_opt::IncrementalSolver.

Definition at line 236 of file solve_impl.cc.

◆ Update()

absl::StatusOr< UpdateResult > operations_research::math_opt::internal::IncrementalSolverImpl::Update ( )
overridevirtual

Updates the model to solve.

This is an advanced API, most users should use Solve() above that does the update and before calling the solver. Calling this function is only useful for users that want to access to update data or users that need to use SolveWithoutUpdate() (which should not be common).

The returned value indicates if the update was possible or if the solver had to be recreated from scratch (which may happen when the solver does not support this specific update or any update at all). It also contains the attempted update data.

A status error will be returned if the underlying solver has an internal error.

Todo
: b/260337466 - Add permanent errors and concurrency protection.

Implements operations_research::math_opt::IncrementalSolver.

Definition at line 208 of file solve_impl.cc.


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