Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
lp_incomplete_solve_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_LP_INCOMPLETE_SOLVE_TESTS_H_
15#define OR_TOOLS_MATH_OPT_SOLVER_TESTS_LP_INCOMPLETE_SOLVE_TESTS_H_
16
17#include <optional>
18
19#include "gtest/gtest.h"
21
22namespace operations_research {
23namespace math_opt {
24
25// TODO(b/195295177): Consider splitting LpIncompleteSolveTest into simplex and
26// non-simplex tests to avoid repetition and need to input irrelevant bools from
27// LpIncompleteSolveTestParams when instantiating tests.
28
29// Parameters for the LpIncompleteSolveTest suite below.
32 std::optional<LPAlgorithm> lp_algorithm,
40
41 // The tested solver.
43
44 // The tested algorithm.
45 std::optional<LPAlgorithm> lp_algorithm;
46
47 // Indicates if the solver supports iteration limit.
49
50 // Indicates if the solver supports initial basis.
52
53 // Indicates if the solver supports incremental solves.
55
56 // Indicates if the solver supports returning a basis.
58
59 // Indicates if the solver supports setting the presolve emphasis.
61
62 // Indicates if we should check primal objective values.
64
65 // Indicates if solver always sets a precise primal feasibility status
66 // (i.e. never returns an unspecified status).
68
69 // Indicates if solver always sets a precise dual feasibility status
70 // (i.e. never returns an unspecified status).
72};
73
74// A suite of unit tests to show that an LP solver handles incomplete solves
75// correctly.
76//
77// To use these tests, in file <solver>_test.cc write:
78// INSTANTIATE_TEST_SUITE_P(<Solver>LpIncompleteSolveTest,
79// LpIncompleteSolveTest,
80// testing::Values(lp_incomplete_solve_test_params));
81//
82// Note: If supports_presolve == True, presolve will be turned off in all tests.
84 : public ::testing::TestWithParam<LpIncompleteSolveTestParams> {
85 protected:
86 SolverType TestedSolver() const { return GetParam().solver_type; }
87};
88
89} // namespace math_opt
90} // namespace operations_research
91
92#endif // OR_TOOLS_MATH_OPT_SOLVER_TESTS_LP_INCOMPLETE_SOLVE_TESTS_H_
SolverType
The solvers supported by MathOpt.
Definition parameters.h:42
In SWIG mode, we don't want anything besides these top-level includes.
Parameters for the LpIncompleteSolveTest suite below.
bool supports_presolve
Indicates if the solver supports setting the presolve emphasis.
LpIncompleteSolveTestParams(SolverType solver_type, std::optional< LPAlgorithm > lp_algorithm, bool supports_iteration_limit, bool supports_initial_basis, bool supports_incremental_solve, bool supports_basis, bool supports_presolve, bool check_primal_objective, bool primal_solution_status_always_set, bool dual_solution_status_always_set)
bool supports_iteration_limit
Indicates if the solver supports iteration limit.
bool supports_basis
Indicates if the solver supports returning a basis.
bool check_primal_objective
Indicates if we should check primal objective values.
std::optional< LPAlgorithm > lp_algorithm
The tested algorithm.
bool supports_incremental_solve
Indicates if the solver supports incremental solves.
bool supports_initial_basis
Indicates if the solver supports initial basis.