Google OR-Tools
v9.15
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
inverted_bounds.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_CORE_INVERTED_BOUNDS_H_
15
#define ORTOOLS_MATH_OPT_CORE_INVERTED_BOUNDS_H_
16
17
#include <cstddef>
18
#include <cstdint>
19
#include <vector>
20
21
#include "absl/status/status.h"
22
23
namespace
operations_research::math_opt
{
24
25
// The maximum number of variables/constraints with inverted bounds to report.
26
constexpr
std::size_t
kMaxInvertedBounds
= 10;
27
28
// The ids of the variables and linear constraints with inverted bounds
29
// (lower_bounds > upper_bounds).
30
//
31
// This is used internally by solvers to return an error on Solve() when bounds
32
// are inverted.
33
struct
InvertedBounds
{
34
// Returns true if this object contains no variable/constraint ids.
35
bool
empty
()
const
{
return
variables
.empty() &&
linear_constraints
.empty(); }
36
37
// Returns an error listing at most kMaxInvertedBounds variables and linear
38
// constraints ids (kMaxInvertedBounds of each). Returns OK status if this
39
// object is empty.
40
absl::Status
ToStatus
()
const
;
41
42
// Ids of the variables with inverted bounds.
43
std::vector<int64_t>
variables
;
44
45
// Ids of the linear constraints with inverted bounds.
46
std::vector<int64_t>
linear_constraints
;
47
};
48
49
}
// namespace operations_research::math_opt
50
51
#endif
// ORTOOLS_MATH_OPT_CORE_INVERTED_BOUNDS_H_
operations_research::math_opt
Definition
gurobi_isv.cc:28
operations_research::math_opt::kMaxInvertedBounds
constexpr std::size_t kMaxInvertedBounds
Definition
inverted_bounds.h:26
operations_research::math_opt::InvertedBounds
Definition
inverted_bounds.h:33
operations_research::math_opt::InvertedBounds::linear_constraints
std::vector< int64_t > linear_constraints
Definition
inverted_bounds.h:46
operations_research::math_opt::InvertedBounds::empty
bool empty() const
Definition
inverted_bounds.h:35
operations_research::math_opt::InvertedBounds::variables
std::vector< int64_t > variables
Definition
inverted_bounds.h:43
operations_research::math_opt::InvertedBounds::ToStatus
absl::Status ToStatus() const
Definition
inverted_bounds.cc:28
ortools
math_opt
core
inverted_bounds.h
Generated by
1.15.0