Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
matchers.h File Reference
#include <optional>
#include <ostream>
#include <string>
#include <type_traits>
#include <vector>
#include "absl/container/flat_hash_map.h"
#include "absl/status/statusor.h"
#include "gtest/gtest.h"
#include "ortools/base/gmock.h"
#include "ortools/math_opt/constraints/quadratic/quadratic_constraint.h"
#include "ortools/math_opt/cpp/linear_constraint.h"
#include "ortools/math_opt/cpp/math_opt.h"
#include "ortools/math_opt/cpp/update_result.h"
#include "ortools/math_opt/cpp/variable_and_expressions.h"

Go to the source code of this file.

Classes

struct  operations_research::math_opt::SolutionMatcherOptions
 Options for IsNear(Solution). More...
 
struct  operations_research::math_opt::SolveResultMatcherOptions
 Configures SolveResult matcher IsConsistentWith() below. More...
 

Namespaces

namespace  operations_research
 In SWIG mode, we don't want anything besides these top-level includes.
 
namespace  operations_research::math_opt
 An object oriented wrapper for quadratic constraints in ModelStorage.
 

Typedefs

using operations_research::math_opt::MockSolveFunction
 

Functions

Matcher< VariableMap< double > > operations_research::math_opt::IsNear (VariableMap< double > expected, const double tolerance)
 
Matcher< VariableMap< double > > operations_research::math_opt::IsNearlySubsetOf (VariableMap< double > expected, double tolerance)
 
Matcher< LinearConstraintMap< double > > operations_research::math_opt::IsNear (LinearConstraintMap< double > expected, const double tolerance)
 
Matcher< LinearConstraintMap< double > > operations_research::math_opt::IsNearlySubsetOf (LinearConstraintMap< double > expected, double tolerance)
 
Matcher< absl::flat_hash_map< QuadraticConstraint, double > > operations_research::math_opt::IsNear (absl::flat_hash_map< QuadraticConstraint, double > expected, const double tolerance)
 
Matcher< absl::flat_hash_map< QuadraticConstraint, double > > operations_research::math_opt::IsNearlySubsetOf (absl::flat_hash_map< QuadraticConstraint, double > expected, double tolerance)
 
testing::Matcher< LinearExpressionoperations_research::math_opt::IsIdentical (LinearExpression expected)
 
testing::Matcher< LinearExpressionoperations_research::math_opt::LinearExpressionIsNear (const LinearExpression expected, const double tolerance)
 
testing::Matcher< BoundedLinearExpressionoperations_research::math_opt::IsNearlyEquivalent (const BoundedLinearExpression &expected, const double tolerance)
 
testing::Matcher< QuadraticExpressionoperations_research::math_opt::IsIdentical (QuadraticExpression expected)
 
Matcher< Solutionoperations_research::math_opt::IsNear (Solution expected, const SolutionMatcherOptions options)
 
Matcher< PrimalSolutionoperations_research::math_opt::IsNear (PrimalSolution expected, const double tolerance, const bool allow_undetermined)
 
Matcher< DualSolutionoperations_research::math_opt::IsNear (DualSolution expected, const double tolerance, const bool allow_undetermined)
 
Matcher< Basisoperations_research::math_opt::BasisIs (const Basis &expected)
 
Matcher< PrimalRayoperations_research::math_opt::IsNear (PrimalRay expected, const double tolerance)
 
Matcher< PrimalRayoperations_research::math_opt::PrimalRayIsNear (VariableMap< double > expected_var_values, const double tolerance)
 
Matcher< DualRayoperations_research::math_opt::IsNear (DualRay expected, const double tolerance)
 
Matcher< Terminationoperations_research::math_opt::ReasonIs (TerminationReason reason)
 
Matcher< Terminationoperations_research::math_opt::ReasonIsOptimal ()
 
Matcher< Terminationoperations_research::math_opt::TerminationIsOptimal ()
 
Matcher< Terminationoperations_research::math_opt::TerminationIsOptimal (const double primal_objective_value, const std::optional< double > dual_objective_value, const double tolerance)
 
testing::Matcher< Terminationoperations_research::math_opt::LimitIs (Limit limit, testing::Matcher< std::string > detail_matcher=testing::_)
 
Matcher< Terminationoperations_research::math_opt::TerminationIsIgnoreDetail (const Termination &expected)
 
Matcher< ObjectiveBoundsoperations_research::math_opt::ObjectiveBoundsNear (const ObjectiveBounds &expected, const double tolerance)
 
Matcher< ProblemStatusoperations_research::math_opt::ProblemStatusIs (const ProblemStatus &expected)
 
Matcher< SolveResult > operations_research::math_opt::IsOptimal (const std::optional< double > expected_primal_objective, const double tolerance)
 
Matcher< SolveResult > operations_research::math_opt::IsOptimalWithSolution (const double expected_objective, const VariableMap< double > expected_variable_values, const double tolerance)
 
Matcher< SolveResult > operations_research::math_opt::IsOptimalWithDualSolution (const double expected_objective, const LinearConstraintMap< double > expected_dual_values, const VariableMap< double > expected_reduced_costs, const double tolerance)
 
Matcher< SolveResult > operations_research::math_opt::IsOptimalWithDualSolution (const double expected_objective, const LinearConstraintMap< double > expected_dual_values, const absl::flat_hash_map< QuadraticConstraint, double > expected_quadratic_dual_values, const VariableMap< double > expected_reduced_costs, const double tolerance)
 
Matcher< SolveResult > operations_research::math_opt::TerminatesWith (const TerminationReason expected)
 
Matcher< SolveResult > operations_research::math_opt::TerminatesWithOneOf (const std::vector< TerminationReason > &allowed)
 Checks that the result has one of the allowed termination reasons.
 
testing::Matcher< SolveResult > operations_research::math_opt::TerminatesWithLimit (const Limit expected, const bool allow_limit_undetermined)
 
testing::Matcher< SolveResult > operations_research::math_opt::TerminatesWithReasonFeasible (const Limit expected, const bool allow_limit_undetermined)
 
testing::Matcher< SolveResult > operations_research::math_opt::TerminatesWithReasonNoSolutionFound (const Limit expected, const bool allow_limit_undetermined)
 
Matcher< SolveResult > operations_research::math_opt::HasSolution (PrimalSolution expected, double tolerance=kMatcherDefaultTolerance)
 SolveResult has a primal solution matching expected within tolerance.
 
Matcher< SolveResult > operations_research::math_opt::HasDualSolution (DualSolution expected, const double tolerance)
 
Matcher< SolveResult > operations_research::math_opt::HasPrimalRay (PrimalRay expected, const double tolerance)
 
Matcher< SolveResult > operations_research::math_opt::HasPrimalRay (VariableMap< double > expected_vars, const double tolerance)
 
Matcher< SolveResult > operations_research::math_opt::HasDualRay (DualRay expected, const double tolerance)
 
Matcher< SolveResult > operations_research::math_opt::IsConsistentWith (const SolveResult &expected, const SolveResultMatcherOptions &options)
 
testing::Matcher< ComputeInfeasibleSubsystemResultoperations_research::math_opt::IsFeasible ()
 
testing::Matcher< ComputeInfeasibleSubsystemResultoperations_research::math_opt::IsUndetermined ()
 
testing::Matcher< ComputeInfeasibleSubsystemResultoperations_research::math_opt::IsInfeasible (const std::optional< bool > expected_is_minimal, const std::optional< ModelSubset > expected_infeasible_subsystem)
 
Matcher< UpdateResultoperations_research::math_opt::DidUpdate ()
 Actual UpdateResult.did_update is true.
 
void operations_research::math_opt::PrintTo (const PrimalSolution &primal_solution, std::ostream *const os)
 
void operations_research::math_opt::PrintTo (const DualSolution &dual_solution, std::ostream *const os)
 
void operations_research::math_opt::PrintTo (const PrimalRay &primal_ray, std::ostream *const os)
 
void operations_research::math_opt::PrintTo (const DualRay &dual_ray, std::ostream *const os)
 
void operations_research::math_opt::PrintTo (const Basis &basis, std::ostream *const os)
 
void operations_research::math_opt::PrintTo (const Solution &solution, std::ostream *const os)
 
void operations_research::math_opt::PrintTo (const SolveResult &result, std::ostream *const os)
 
template<typename K , typename V , typename = std::enable_if_t<is_key_type_v<K>>>
void operations_research::math_opt::PrintTo (const absl::flat_hash_map< K, V > &id_map, std::ostream *const os)
 

Variables

constexpr double operations_research::math_opt::kMatcherDefaultTolerance = 1e-5
 
For infeasible and unbounded operations_research::math_opt::problems
 
For infeasible and unbounded see Not checked if options check_solutions_if_inf_or_unbounded and the If options first_solution_only is operations_research::math_opt::false
 problem is infeasible or unbounded (default).
 
For infeasible and unbounded see Not checked if options check_solutions_if_inf_or_unbounded and the If options first_solution_only is check the entire list of Dual solution is not checked if options operations_research::math_opt::check_dual
 solutions matches in the same order.