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  * @file lbpInterval.h
11  *
12  * @brief File containing declaration of LbpInterval class used for solving the
13  * lower bounding problems.
14  *
15  **********************************************************************************/
16 
17 #pragma once
18 
19 #include "lbp.h"
20 
21 
22 namespace maingo {
23 
24 
25 namespace lbp {
26 
27 
34 
35  public:
52  LbpInterval(mc::FFGraph &DAG, const std::vector<mc::FFVar> &DAGvars, const std::vector<mc::FFVar> &DAGfunctions,
53  const std::vector<babBase::OptimizationVariable> &variables, const unsigned nineqIn, const unsigned neqIn,
54  const unsigned nineqRelaxationOnlyIn, const unsigned neqRelaxationOnlyIn, const unsigned nineqSquashIn,
55  Settings *settingsIn, Logger *loggerIn, std::vector<Constraint> *constraintPropertiesIn);
56 
60  void activate_more_scaling();
61 
62  protected:
69  void _set_variable_bounds(const std::vector<double> &lowerVarBounds, const std::vector<double> &upperVarBounds);
70 
78 
89  void _update_LP_obj(const MC &resultRelaxation, const std::vector<double> &linearizationPoint, const std::vector<double> &lowerVarBounds,
90  const std::vector<double> &upperVarBounds, unsigned const &iLin, unsigned const &iObj);
91 
102  void _update_LP_ineq(const MC &resultRelaxation, const std::vector<double> &linearizationPoint, const std::vector<double> &lowerVarBounds,
103  const std::vector<double> &upperVarBounds, unsigned const &iLin, unsigned const &iIneq);
104 
116  void _update_LP_eq(const MC &resultRelaxationCv, const MC &resultRelaxationCc, const std::vector<double> &linearizationPoint, const std::vector<double> &lowerVarBounds,
117  const std::vector<double> &upperVarBounds, unsigned const &iLin, unsigned const &iEq);
118 
129  void _update_LP_ineqRelaxationOnly(const MC &resultRelaxation, const std::vector<double> &linearizationPoint, const std::vector<double> &lowerVarBounds,
130  const std::vector<double> &upperVarBounds, unsigned const &iLin, unsigned const &iIneqRelaxationOnly);
131 
143  void _update_LP_eqRelaxationOnly(const MC &resultRelaxationCv, const MC &resultRelaxationCc, const std::vector<double> &linearizationPoint, const std::vector<double> &lowerVarBounds,
144  const std::vector<double> &upperVarBounds, unsigned const &iLin, unsigned const &iEqRelaxationOnly);
145 
157  void _update_LP_ineq_squash(const MC &resultRelaxation, const std::vector<double> &linearizationPoint, const std::vector<double> &lowerVarBounds,
158  const std::vector<double> &upperVarBounds, unsigned const &iLin, unsigned const &iIneqSquash);
159 
166  void _solve_LP(const babBase::BabNode &currentNode);
167 
172 
173 #ifdef LP__OPTIMALITY_CHECK
174 
181 
188  SUBSOLVER_RETCODE _check_feasibility(const std::vector<double> &solution);
189 
200  SUBSOLVER_RETCODE _check_optimality(const babBase::BabNode &currentNode, const double newLBD, const std::vector<double> &solution, const double etaVal, const std::vector<double> &multipliers);
201 #endif
202 
203 #ifdef LP__WRITE_CHECK_FILES
204 
209  void _write_LP_to_file(std::string &fileName);
210 #endif
211 
212  private:
217  std::vector<I> _resultInterval;
218  std::vector<I> _Intervals;
219  std::vector<I> _Iarray;
221 };
222 
223 
224 } // end of namespace lbp
225 
226 
227 } // end of namespace maingo
Wrapper for handling the lower bounding problems as well as optimization-based bounds tightening (OBB...
Definition: lbp.h:60
LINEARIZATION_RETCODE _update_LP(const babBase::BabNode &currentNode)
Calls the proper function for computing Intervals.
Definition: lbpInterval.cpp:79
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:124
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:54
Wrapper for handling the lower bounding problems by using interval arithmetics. We currently do a bit...
Definition: lbpInterval.h:33
Struct for storing settings for MAiNGO.
Definition: settings.h:143
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:230
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:114
LINEARIZATION_RETCODE
Enum for representing the return codes returned by the different linearization techniques.
Definition: returnCodes.h:63
std::vector< I > _resultInterval
Definition: lbpInterval.h:217
This class contains all logging and output information.
Definition: logger.h:100
std::vector< I > _Intervals
Definition: lbpInterval.h:218
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, Settings *settingsIn, Logger *loggerIn, std::vector< Constraint > *constraintPropertiesIn)
Constructor, stores information on the problem.
Definition: lbpInterval.cpp:28
SUBSOLVER_RETCODE
Enum for representing the return codes returned by the different sub-solvers (UpperBoundingSolver,...
Definition: returnCodes.h:40
namespace holding all essentials of MAiNGO
Definition: aleModel.h:31
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:154
mc::McCormick< I > MC
A type definition for a McCormick variable.
Definition: intervalLibrary.h:57
void _solve_LP(const babBase::BabNode &currentNode)
Function for solving the currently constructed linear program. This function also internally sets the...
Definition: lbpInterval.cpp:164
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:64
std::vector< I > _Iarray
Definition: lbpInterval.h:219
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:134
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:104
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:144