MAiNGO
ubpNLopt.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 ubpNLopt.h
11  *
12  * @brief File containing declaration of UbpNLopt class used for solving the
13  * upper bounding problems.
14  *
15  **********************************************************************************/
16 
17 #pragma once
18 
19 #include "ubp.h"
20 
21 #include "nlopt.hpp"
22 
23 
24 namespace maingo {
25 
26 
27 namespace ubp {
28 
29 
39 
40  public:
56  UbpNLopt(mc::FFGraph& DAG, const std::vector<mc::FFVar>& DAGvars, const std::vector<mc::FFVar>& DAGfunctions, const std::vector<babBase::OptimizationVariable>& variables,
57  const unsigned nineqIn, const unsigned neqIn, const unsigned nineqSquashIn, Settings* settingsIn, Logger* loggerIn, std::vector<Constraint>* constraintPropertiesIn, UBS_USE useIn);
58 
59  private:
69  virtual SUBSOLVER_RETCODE _solve_nlp(const std::vector<double>& lowerVarBounds, const std::vector<double>& upperVarBounds, double& objectiveValue, std::vector<double>& solutionPoint);
70 
75  nlopt::opt _NLopt;
76  nlopt::opt _NLoptSubopt;
90  static double _NLopt_get_objective(const std::vector<double>& x, std::vector<double>& grad, void* f_data);
91 
102  static void _NLopt_get_ineq(unsigned m, double* result, unsigned n, const double* x, double* grad, void* f_data);
103 
114  static void _NLopt_get_eq(unsigned m, double* result, unsigned n, const double* x, double* grad, void* f_data);
117  // Prevent use of default copy constructor and copy assignment operator by declaring them private:
118  UbpNLopt(const UbpNLopt&);
119  UbpNLopt& operator=(const UbpNLopt&);
120 };
121 
122 
123 } // end namespace ubp
124 
125 
126 } // end namespace maingo
Struct for storing settings for MAiNGO.
Definition: settings.h:143
static double _NLopt_get_objective(const std::vector< double > &x, std::vector< double > &grad, void *f_data)
Function returning the objective value to the NLopt interface.
Definition: ubpNLopt.cpp:186
nlopt::opt _NLoptSubopt
Definition: ubpNLopt.h:76
virtual SUBSOLVER_RETCODE _solve_nlp(const std::vector< double > &lowerVarBounds, const std::vector< double > &upperVarBounds, double &objectiveValue, std::vector< double > &solutionPoint)
Function for actually solving the NLP sub-problem.
Definition: ubpNLopt.cpp:139
This class contains all logging and output information.
Definition: logger.h:100
UbpNLopt & operator=(const UbpNLopt &)
Base class for wrappers for handling the upper bounding problems.
Definition: ubp.h:49
SUBSOLVER_RETCODE
Enum for representing the return codes returned by the different sub-solvers (UpperBoundingSolver,...
Definition: returnCodes.h:40
nlopt::opt _NLopt
Definition: ubpNLopt.h:75
static void _NLopt_get_eq(unsigned m, double *result, unsigned n, const double *x, double *grad, void *f_data)
Function providing gradient and value information on equalities to the NLopt interface.
Definition: ubpNLopt.cpp:216
namespace holding all essentials of MAiNGO
Definition: aleModel.h:31
UbpNLopt(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 nineqSquashIn, Settings *settingsIn, Logger *loggerIn, std::vector< Constraint > *constraintPropertiesIn, UBS_USE useIn)
Constructor, stores information on the problem and initializes the local-subsolvers used.
Definition: ubpNLopt.cpp:28
UBS_USE
Enum for communicating what the intended purpose of the solver is. This determines which settings are...
Definition: ubp.h:56
Wrapper for handling the upper bounding problems by interfacing NLopt.
Definition: ubpNLopt.h:38
static void _NLopt_get_ineq(unsigned m, double *result, unsigned n, const double *x, double *grad, void *f_data)
Function providing gradient and value information on inequalities to the NLopt interface.
Definition: ubpNLopt.cpp:201