Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
gap.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_SOLVERS_GLPK_GAP_H_
15#define OR_TOOLS_MATH_OPT_SOLVERS_GLPK_GAP_H_
16
18
19// Returns the worst dual bound corresponding to the given objective value and
20// relative gap limit. This should be used when glp_intopt() returns GLP_EMIPGAP
21// (i.e. stopped because of the gap limit) but the best_dual_bound is not
22// available.
23//
24// GLPK define the relative gap as:
25//
26// |best_objective_value − best_dual_bound|
27// gap := ----------------------------------------
28// |best_objective_value| + DBL_EPSILON
29//
30// This function thus returns the value of best_dual_bound that makes gap match
31// the relative_gap_limit.
32//
33// Negative or NaN relative_gap_limit is considered 0. If the relative_gap_limit
34// is +inf, returns the infinite dual bound corresponding to the is_maximize.
35//
36// If the objective_value is infinite or NaN, returns the same value as the
37// worst dual bound (in practice the objective_value should be finite).
38double WorstGLPKDualBound(bool is_maximize, double objective_value,
39 double relative_gap_limit);
40
41} // namespace operations_research::math_opt
42
43#endif // OR_TOOLS_MATH_OPT_SOLVERS_GLPK_GAP_H_
An object oriented wrapper for quadratic constraints in ModelStorage.
Definition gurobi_isv.cc:28
double WorstGLPKDualBound(const bool is_maximize, const double objective_value, const double relative_gap_limit)
Definition gap.cc:23
double objective_value
The value objective_vector^T * (solution - center_point).