Google OR-Tools
v9.15
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
mip_tests.h
Go to the documentation of this file.
1
// Copyright 2010-2025 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 ORTOOLS_MATH_OPT_SOLVER_TESTS_MIP_TESTS_H_
15
#define ORTOOLS_MATH_OPT_SOLVER_TESTS_MIP_TESTS_H_
16
17
#include <memory>
18
#include <ostream>
19
20
#include "gtest/gtest.h"
21
#include "
ortools/math_opt/cpp/math_opt.h
"
22
#include "
ortools/math_opt/solver_tests/base_solver_test.h
"
23
24
namespace
operations_research
{
25
namespace
math_opt
{
26
27
struct
SimpleMipTestParameters
{
28
explicit
SimpleMipTestParameters
(
SolverType
solver_type
,
29
bool
report_unboundness_correctly
=
true
);
30
31
// The tested solver.
32
SolverType
solver_type
;
33
34
// True if the solver reports unbound MIPs as UNBOUNDED or DUAL_INFEASIBLE. If
35
// false, the solver is expected to return OTHER_ERROR.
36
//
37
// TODO(b/202159173): remove this when we start using the direct CP-SAT API
38
// and thus will be able to get proper details.
39
bool
report_unboundness_correctly
;
40
};
41
42
std::ostream&
operator<<
(std::ostream& out,
43
const
SimpleMipTestParameters
& params);
44
45
// A suite of unit tests to validate that mandatory behavior for MIP solvers.
46
//
47
// To use these tests, in file <solver>_test.cc, write:
48
// INSTANTIATE_TEST_SUITE_P(
49
// <Solver>SimpleMipTest, SimpleMipTest,
50
// testing::Values(SimpleMipTestParameters(SolverType::k<Solver>)));
51
class
SimpleMipTest
:
public
::testing::TestWithParam<SimpleMipTestParameters> {
52
};
53
54
class
IncrementalMipTest
:
public
BaseSolverTest
{
55
protected
:
56
IncrementalMipTest
();
57
58
Model
model_
;
59
const
Variable
x_
;
60
const
Variable
y_
;
61
const
LinearConstraint
c_
;
62
std::unique_ptr<IncrementalSolver>
solver_
;
63
};
64
65
}
// namespace math_opt
66
}
// namespace operations_research
67
68
#endif
// ORTOOLS_MATH_OPT_SOLVER_TESTS_MIP_TESTS_H_
base_solver_test.h
operations_research::math_opt::BaseSolverTest
Definition
base_solver_test.h:23
operations_research::math_opt::IncrementalMipTest::model_
Model model_
Definition
mip_tests.h:58
operations_research::math_opt::IncrementalMipTest::IncrementalMipTest
IncrementalMipTest()
operations_research::math_opt::IncrementalMipTest::c_
const LinearConstraint c_
Definition
mip_tests.h:61
operations_research::math_opt::IncrementalMipTest::solver_
std::unique_ptr< IncrementalSolver > solver_
Definition
mip_tests.h:62
operations_research::math_opt::IncrementalMipTest::x_
const Variable x_
Definition
mip_tests.h:59
operations_research::math_opt::IncrementalMipTest::y_
const Variable y_
Definition
mip_tests.h:60
operations_research::math_opt::LinearConstraint
Definition
linear_constraint.h:42
operations_research::math_opt::Model
Definition
model.h:113
operations_research::math_opt::SimpleMipTest
Definition
mip_tests.h:51
operations_research::math_opt::Variable
Definition
variable_and_expressions.h:125
math_opt.h
operations_research::math_opt
Definition
gurobi_isv.cc:28
operations_research::math_opt::SolverType
SolverType
Definition
parameters.h:41
operations_research::math_opt::operator<<
std::ostream & operator<<(std::ostream &ostr, const SecondOrderConeConstraint &constraint)
Definition
second_order_cone_constraint.h:125
operations_research
OR-Tools root namespace.
Definition
binary_indexed_tree.h:21
operations_research::math_opt::SimpleMipTestParameters
Definition
mip_tests.h:27
operations_research::math_opt::SimpleMipTestParameters::SimpleMipTestParameters
SimpleMipTestParameters(SolverType solver_type, bool report_unboundness_correctly=true)
Definition
mip_tests.cc:40
operations_research::math_opt::SimpleMipTestParameters::solver_type
SolverType solver_type
Definition
mip_tests.h:32
operations_research::math_opt::SimpleMipTestParameters::report_unboundness_correctly
bool report_unboundness_correctly
Definition
mip_tests.h:39
ortools
math_opt
solver_tests
mip_tests.h
Generated by
1.15.0