MAiNGO
lbpInterval.h
Go to the documentation of this file.
1 /**********************************************************************************
2  * Copyright (c) 2019 Process Systems Engineering (AVT.SVT), RWTH Aachen University
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License 2.0 which is available at
6  * http://www.eclipse.org/legal/epl-2.0.
7  *
8  * SPDX-License-Identifier: EPL-2.0
9  *
10  **********************************************************************************/
11 
12 #pragma once
13 
14 #include "lbp.h"
15 
16 
17 namespace maingo {
18 
19 
20 namespace lbp {
21 
22 
29 
30  public:
47  LbpInterval(mc::FFGraph &DAG, const std::vector<mc::FFVar> &DAGvars, const std::vector<mc::FFVar> &DAGfunctions,
48  const std::vector<babBase::OptimizationVariable> &variables, const unsigned nineqIn, const unsigned neqIn,
49  const unsigned nineqRelaxationOnlyIn, const unsigned neqRelaxationOnlyIn, const unsigned nineqSquashIn,
50  std::shared_ptr<Settings> settingsIn, std::shared_ptr<Logger> loggerIn, std::shared_ptr<std::vector<Constraint>> constraintPropertiesIn);
51 
55  void activate_more_scaling();
56 
57  protected:
64  void _set_variable_bounds(const std::vector<double> &lowerVarBounds, const std::vector<double> &upperVarBounds);
65 
73 
84  void _update_LP_obj(const MC &resultRelaxation, const std::vector<double> &linearizationPoint, const std::vector<double> &lowerVarBounds,
85  const std::vector<double> &upperVarBounds, unsigned const &iLin, unsigned const &iObj);
86 
97  void _update_LP_ineq(const MC &resultRelaxation, const std::vector<double> &linearizationPoint, const std::vector<double> &lowerVarBounds,
98  const std::vector<double> &upperVarBounds, unsigned const &iLin, unsigned const &iIneq);
99 
111  void _update_LP_eq(const MC &resultRelaxationCv, const MC &resultRelaxationCc, const std::vector<double> &linearizationPoint, const std::vector<double> &lowerVarBounds,
112  const std::vector<double> &upperVarBounds, unsigned const &iLin, unsigned const &iEq);
113 
124  void _update_LP_ineqRelaxationOnly(const MC &resultRelaxation, const std::vector<double> &linearizationPoint, const std::vector<double> &lowerVarBounds,
125  const std::vector<double> &upperVarBounds, unsigned const &iLin, unsigned const &iIneqRelaxationOnly);
126 
138  void _update_LP_eqRelaxationOnly(const MC &resultRelaxationCv, const MC &resultRelaxationCc, const std::vector<double> &linearizationPoint, const std::vector<double> &lowerVarBounds,
139  const std::vector<double> &upperVarBounds, unsigned const &iLin, unsigned const &iEqRelaxationOnly);
140 
152  void _update_LP_ineq_squash(const MC &resultRelaxation, const std::vector<double> &linearizationPoint, const std::vector<double> &lowerVarBounds,
153  const std::vector<double> &upperVarBounds, unsigned const &iLin, unsigned const &iIneqSquash);
154 
161  void _solve_LP(const babBase::BabNode &currentNode);
162 
167 
168 #ifdef LP__OPTIMALITY_CHECK
169 
176 
183  SUBSOLVER_RETCODE _check_feasibility(const std::vector<double> &solution);
184 
195  SUBSOLVER_RETCODE _check_optimality(const babBase::BabNode &currentNode, const double newLBD, const std::vector<double> &solution, const double etaVal, const std::vector<double> &multipliers);
196 #endif
197 
198 #ifdef LP__WRITE_CHECK_FILES
199 
204  void _write_LP_to_file(std::string &fileName);
205 #endif
206 
207  private:
212  std::vector<I> _resultInterval;
213  std::vector<I> _Intervals;
214  std::vector<I> _Iarray;
216 };
217 
218 
219 } // end of namespace lbp
220 
221 
222 } // end of namespace maingo
Wrapper for handling the lower bounding problems as well as optimization-based bounds tightening (OBB...
Definition: lbp.h:65
LINEARIZATION_RETCODE _update_LP(const babBase::BabNode &currentNode)
Calls the proper function for computing Intervals.
Definition: lbpInterval.cpp:74
void _update_LP_eq(const MC &resultRelaxationCv, const MC &resultRelaxationCc, const std::vector< double > &linearizationPoint, const std::vector< double > &lowerVarBounds, const std::vector< double > &upperVarBounds, unsigned const &iLin, unsigned const &iEq)
Auxiliary function for updating LP equalities, i.e., processing the linearization of the equality...
Definition: lbpInterval.cpp:119
Class representing a node in the Branch-and-Bound tree.
Definition: babNode.h:35
void activate_more_scaling()
Function called by the B&B solver to heuristically activate more scaling in the LBS.
Definition: lbpInterval.cpp:49
Wrapper for handling the lower bounding problems by using interval arithmetics. We currently do a bit...
Definition: lbpInterval.h:28
SUBSOLVER_RETCODE _check_optimality(const babBase::BabNode &currentNode, const double newLBD, const std::vector< double > &solution, const double etaVal, const std::vector< double > &multipliers)
Function for checking if the solution point returned is really optimal. Not available in this solver...
void _turn_off_specific_options()
Function for checking if a specific option has to be turned off for a given lower bounding solver...
Definition: lbpInterval.cpp:225
void _update_LP_ineq(const MC &resultRelaxation, const std::vector< double > &linearizationPoint, const std::vector< double > &lowerVarBounds, const std::vector< double > &upperVarBounds, unsigned const &iLin, unsigned const &iIneq)
Auxiliary function for updating LP inequalities, i.e., processing the linearization of the inequality...
Definition: lbpInterval.cpp:109
LINEARIZATION_RETCODE
Enum for representing the return codes returned by the different linearization techniques.
Definition: returnCodes.h:59
std::vector< I > _resultInterval
Definition: lbpInterval.h:212
std::vector< I > _Intervals
Definition: lbpInterval.h:213
SUBSOLVER_RETCODE
Enum for representing the return codes returned by the different sub-solvers (UpperBoundingSolver, LowerBoundingSolver).
Definition: returnCodes.h:36
namespace holding all essentials of MAiNGO
Definition: aleModel.h:25
void _update_LP_ineq_squash(const MC &resultRelaxation, const std::vector< double > &linearizationPoint, const std::vector< double > &lowerVarBounds, const std::vector< double > &upperVarBounds, unsigned const &iLin, unsigned const &iIneqSquash)
Auxiliary function for updating LP squash inequalities, i.e., processing the linearization of the squ...
Definition: lbpInterval.cpp:149
mc::McCormick< I > MC
A type definition for a McCormick variable.
Definition: intervalLibrary.h:34
void _solve_LP(const babBase::BabNode &currentNode)
Function for solving the currently constructed linear program. This function also internally sets the...
Definition: lbpInterval.cpp:159
SUBSOLVER_RETCODE _check_infeasibility(const babBase::BabNode &currentNode)
Function for checking if the solution point returned is really infeasible. Not available in this solv...
void _set_variable_bounds(const std::vector< double > &lowerVarBounds, const std::vector< double > &upperVarBounds)
Function for setting the interval bounds.
Definition: lbpInterval.cpp:59
std::vector< I > _Iarray
Definition: lbpInterval.h:214
SUBSOLVER_RETCODE _check_feasibility(const std::vector< double > &solution)
Function for checking if the solution point returned is really feasible. Not available in this solver...
void _update_LP_ineqRelaxationOnly(const MC &resultRelaxation, const std::vector< double > &linearizationPoint, const std::vector< double > &lowerVarBounds, const std::vector< double > &upperVarBounds, unsigned const &iLin, unsigned const &iIneqRelaxationOnly)
Auxiliary function for updating LP relaxation only inequalities, i.e., processing the linearization o...
Definition: lbpInterval.cpp:129
LbpInterval(mc::FFGraph &DAG, const std::vector< mc::FFVar > &DAGvars, const std::vector< mc::FFVar > &DAGfunctions, const std::vector< babBase::OptimizationVariable > &variables, const unsigned nineqIn, const unsigned neqIn, const unsigned nineqRelaxationOnlyIn, const unsigned neqRelaxationOnlyIn, const unsigned nineqSquashIn, std::shared_ptr< Settings > settingsIn, std::shared_ptr< Logger > loggerIn, std::shared_ptr< std::vector< Constraint >> constraintPropertiesIn)
Constructor, stores information on the problem.
Definition: lbpInterval.cpp:23
void _update_LP_obj(const MC &resultRelaxation, const std::vector< double > &linearizationPoint, const std::vector< double > &lowerVarBounds, const std::vector< double > &upperVarBounds, unsigned const &iLin, unsigned const &iObj)
Auxiliary function for updating LP objective, i.e., processing the linearization of the objective fun...
Definition: lbpInterval.cpp:99
void _update_LP_eqRelaxationOnly(const MC &resultRelaxationCv, const MC &resultRelaxationCc, const std::vector< double > &linearizationPoint, const std::vector< double > &lowerVarBounds, const std::vector< double > &upperVarBounds, unsigned const &iLin, unsigned const &iEqRelaxationOnly)
Auxiliary function for updating LP relaxation only equalities, i.e., processing the linearization of ...
Definition: lbpInterval.cpp:139