Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
status_tests.h
Go to the documentation of this file.
1// Copyright 2010-2024 Google LLC
2// Licensed under the Apache License, Version 2.0 (the "License");
3// you may not use this file except in compliance with the License.
4// You may obtain a copy of the License at
5//
6// http://www.apache.org/licenses/LICENSE-2.0
7//
8// Unless required by applicable law or agreed to in writing, software
9// distributed under the License is distributed on an "AS IS" BASIS,
10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11// See the License for the specific language governing permissions and
12// limitations under the License.
13
14#ifndef OR_TOOLS_MATH_OPT_SOLVER_TESTS_STATUS_TESTS_H_
15#define OR_TOOLS_MATH_OPT_SOLVER_TESTS_STATUS_TESTS_H_
16
17#include <ostream>
18#include <utility>
19
20#include "absl/status/statusor.h"
21#include "gtest/gtest.h"
24
26
28 // The tested solver.
31
32 // If true, then a problem status with primal_or_dual_infeasible = true is
33 // never returned.
35
37
38 // True if the tests should be performed with integer variables.
40
42
43 // True if the solver support SolveInterrupter.
45
47
63
64 friend std::ostream& operator<<(std::ostream& out,
65 const StatusTestParameters& params);
66};
67
68class StatusTest : public ::testing::TestWithParam<StatusTestParameters> {
69 protected:
70 SolverType TestedSolver() const { return GetParam().solver_type; }
71 absl::StatusOr<SolveResult> SimpleSolve(const Model& model) {
72 return Solve(model, TestedSolver(), {.parameters = GetParam().parameters});
73 }
74};
75
76} // namespace operations_research::math_opt
77
78#endif // OR_TOOLS_MATH_OPT_SOLVER_TESTS_STATUS_TESTS_H_
absl::StatusOr< SolveResult > SimpleSolve(const Model &model)
GRBmodel * model
An object oriented wrapper for quadratic constraints in ModelStorage.
Definition gurobi_isv.cc:28
SolverType
The solvers supported by MathOpt.
Definition parameters.h:42
absl::StatusOr< SolveResult > Solve(const Model &model, const SolverType solver_type, const SolveArguments &solve_args, const SolverInitArguments &init_args)
Definition solve.cc:62
STL namespace.
StatusTestParameters(const SolverType solver_type, SolveParameters parameters, const bool disallow_primal_or_dual_infeasible, const bool supports_iteration_limit, const bool use_integer_variables, const bool supports_node_limit, const bool support_interrupter, const bool supports_one_thread)
bool support_interrupter
True if the solver support SolveInterrupter.
bool use_integer_variables
True if the tests should be performed with integer variables.
friend std::ostream & operator<<(std::ostream &out, const StatusTestParameters &params)