Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
lp_parameter_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_PARAMETER_TESTS_H_
15#define OR_TOOLS_MATH_OPT_SOLVER_TESTS_LP_PARAMETER_TESTS_H_
16
17#include "gtest/gtest.h"
19
20namespace operations_research {
21namespace math_opt {
22
23// Parameters for the LpParameterTest suite below.
41
42 // The tested solver.
44
45 // Indicates if the solver supports simplex as an algorithm (primal and dual).
47
48 // Indicates if the solver supports barrier as an algorithm.
50
51 // Indicates if the solver supports first-order methods.
53
54 // Indicates if the solver supports setting the random seed.
56
57 // Indicates if the solver supports setting the presolve emphasis.
59
60 // Indicates if the solver supports a cutoff value.
62
63 // Indicates if the solver supports setting a limit on the primal objective.
65
66 // Indicates if the solver supports setting a limit on the best bound.
68
69 // Indicates if the SolveResult returned will say which limit was reached.
71};
72
73// A suite of unit tests to show that an LP solver handles parameters correctly.
74//
75// To use these tests, in file <solver>_test.cc write:
76// INSTANTIATE_TEST_SUITE_P(<Solver>LpParameterTest, LpParameterTest,
77// testing::Values(lp_parameter_test_params));
78class LpParameterTest : public ::testing::TestWithParam<LpParameterTestParams> {
79 protected:
80 SolverType TestedSolver() const { return GetParam().solver_type; }
81 bool SupportsSimplex() const { return GetParam().supports_simplex; }
82 bool SupportsBarrier() const { return GetParam().supports_barrier; }
83 bool SupportsFirstOrder() const { return GetParam().supports_first_order; }
84 bool SupportsRandomSeed() const { return GetParam().supports_random_seed; }
85 bool SupportsPresolve() const { return GetParam().supports_presolve; }
86};
87
88} // namespace math_opt
89} // namespace operations_research
90
91#endif // OR_TOOLS_MATH_OPT_SOLVER_TESTS_LP_PARAMETER_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 LpParameterTest suite below.
bool supports_best_bound_limit
Indicates if the solver supports setting a limit on the best bound.
bool supports_presolve
Indicates if the solver supports setting the presolve emphasis.
LpParameterTestParams(const SolverType solver_type, const bool supports_simplex, const bool supports_barrier, const bool supports_first_order, const bool supports_random_seed, const bool supports_presolve, const bool supports_cutoff, const bool supports_objective_limit, const bool supports_best_bound_limit, const bool reports_limits)
bool supports_cutoff
Indicates if the solver supports a cutoff value.
bool reports_limits
Indicates if the SolveResult returned will say which limit was reached.
bool supports_barrier
Indicates if the solver supports barrier as an algorithm.
bool supports_random_seed
Indicates if the solver supports setting the random seed.
bool supports_simplex
Indicates if the solver supports simplex as an algorithm (primal and dual).
bool supports_first_order
Indicates if the solver supports first-order methods.
bool supports_objective_limit
Indicates if the solver supports setting a limit on the primal objective.