Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
matchers.cc File Reference
#include "ortools/math_opt/cpp/matchers.h"
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <optional>
#include <ostream>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#include "absl/container/flat_hash_map.h"
#include "absl/log/check.h"
#include "absl/strings/str_cat.h"
#include "absl/types/span.h"
#include "gtest/gtest.h"
#include "ortools/base/gmock.h"
#include "ortools/base/logging.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.

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.
 

Functions

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)
 
Matcher< VariableMap< double > > operations_research::math_opt::IsNearlySubsetOf (VariableMap< double > expected, double tolerance)
 
Matcher< VariableMap< double > > operations_research::math_opt::IsNear (VariableMap< double > expected, const double tolerance)
 
Matcher< LinearConstraintMap< double > > operations_research::math_opt::IsNearlySubsetOf (LinearConstraintMap< double > expected, double tolerance)
 
Matcher< LinearConstraintMap< double > > operations_research::math_opt::IsNear (LinearConstraintMap< double > expected, const 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)
 
template<typename K >
Matcher< absl::flat_hash_map< K, double > > operations_research::math_opt::IsNear (absl::flat_hash_map< K, double > expected, const double tolerance)
 
template<typename K >
Matcher< absl::flat_hash_map< K, double > > operations_research::math_opt::IsNearlySubsetOf (absl::flat_hash_map< K, double > expected, const 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< SolutionStatusoperations_research::math_opt::SolutionStatusIs (const SolutionStatus expected, const bool allow_undetermined)
 
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< Solutionoperations_research::math_opt::IsNear (Solution expected, const SolutionMatcherOptions options)
 
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< ObjectiveBoundsoperations_research::math_opt::ObjectiveBoundsNear (const ObjectiveBounds &expected, const double tolerance)
 
Matcher< SolveResult > operations_research::math_opt::TerminatesWithOneOf (const std::vector< TerminationReason > &allowed)
 Checks that the result has one of the allowed termination reasons.
 
Matcher< SolveResult > operations_research::math_opt::TerminatesWith (const TerminationReason expected)
 
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)
 
template<typename MatcherType >
std::string operations_research::math_opt::MatcherToStringImpl (const MatcherType &matcher, const bool negate)
 
template<typename T >
std::string operations_research::math_opt::MatcherToString (const Matcher< T > &matcher, bool negate)
 
template<typename T >
std::string operations_research::math_opt::MatcherToString (const ::testing::PolymorphicMatcher< T > &matcher, bool negate)
 
 operations_research::math_opt::MATCHER_P (FirstElementIs, first_element_matcher,(negation ? absl::StrCat("is empty or first element ", MatcherToString(first_element_matcher, true)) :absl::StrCat("has at least one element and first element ", MatcherToString(first_element_matcher, false))))
 
Matcher< Terminationoperations_research::math_opt::LimitIs (math_opt::Limit limit, const Matcher< std::string > detail_matcher)
 
Matcher< Terminationoperations_research::math_opt::ReasonIs (TerminationReason reason)
 
Matcher< Terminationoperations_research::math_opt::ReasonIsOptimal ()
 
Matcher< ProblemStatusoperations_research::math_opt::ProblemStatusIs (const ProblemStatus &expected)
 
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)
 
Matcher< Terminationoperations_research::math_opt::TerminationIsIgnoreDetail (const Termination &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::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.
 

Variable Documentation

◆ value

const T& value

Definition at line 73 of file matchers.cc.