20#include "absl/strings/str_cat.h"
21#include "gtest/gtest.h"
31 out <<
"{ solver_type: " << params.
solver_type <<
" ensure_hint_in_pool: "
53 const Solution expected1 = {
54 .primal_solution = std::make_optional<PrimalSolution>(
55 {.variable_values = {{
x1, 0.0}, {
x2, 1.0}},
56 .objective_value = 3.0,
59 const Solution expected2 = {
60 .primal_solution = std::make_optional<PrimalSolution>(
61 {.variable_values = {{
x1, 1.0}, {
x2, 0.0}},
62 .objective_value = 1.0,
65 for (int32_t solution_pool_size : {1, 2}) {
66 SCOPED_TRACE(absl::StrCat(
"Solution pool size: ", solution_pool_size));
67 SolveArguments args = {.parameters = GetParam().ensure_hint_in_pool,
68 .model_parameters = model_parameters};
69 args.parameters.solution_pool_size = solution_pool_size;
73 if (solution_pool_size == 1) {
79 ElementsAre(
IsNear(expected1),
80 IsNear(expected2, {.allow_undetermined =
true})));
std::optional< ModelSolveParameters::SolutionHint > hint
An object oriented wrapper for quadratic constraints in ModelStorage.
EXPECT_THAT(ComputeInfeasibleSubsystem(model, GetParam().solver_type), IsOkAndHolds(IsInfeasible(true, ModelSubset{ .variable_bounds={{x, ModelSubset::Bounds{.lower=false,.upper=true}}},.linear_constraints={ {c, ModelSubset::Bounds{.lower=true,.upper=false}}}})))
TEST_P(InfeasibleSubsystemTest, CanComputeInfeasibleSubsystem)
absl::StatusOr< SolveResult > Solve(const Model &model, const SolverType solver_type, const SolveArguments &solve_args, const SolverInitArguments &init_args)
std::ostream & operator<<(std::ostream &ostr, const IndicatorConstraint &constraint)
@ kFeasible
Solver claims the solution is feasible.
Matcher< VariableMap< double > > IsNear(VariableMap< double > expected, const double tolerance)
Matcher< SolveResult > IsOptimal(const std::optional< double > expected_primal_objective, const double tolerance)
std::string ProtobufShortDebugString(const P &message)
#define ASSERT_OK_AND_ASSIGN(lhs, rexpr)
SolveParameters ensure_hint_in_pool
SolverType solver_type
The tested solver.
VariableMap< double > variable_values
std::vector< SolutionHint > solution_hints
SolveParametersProto Proto() const