MAiNGO
ubpCplex.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 ubpCplex.h
11  *
12  * @brief File containing declaration of UbpCplex class used for solving the upper
13  * bounding problems in the case when the underlying problem is an LP, MIP,
14  * QCP, or MIQCP.
15  *
16  **********************************************************************************/
17 
18 #pragma once
19 
20 #include "ubp.h"
21 
22 #include "ilcplex/ilocplex.h"
23 
24 #include <list>
25 #include <utility>
26 
27 
28 namespace maingo {
29 
30 
31 namespace ubp {
32 
33 
42 
43  public:
59  UbpCplex(mc::FFGraph &DAG, const std::vector<mc::FFVar> &DAGvars, const std::vector<mc::FFVar> &DAGfunctions, const std::vector<babBase::OptimizationVariable> &variables,
60  const unsigned nineqIn, const unsigned neqIn, const unsigned nineqSquashIn, Settings *settingsIn, Logger *loggerIn, std::vector<Constraint> *constraintPropertiesIn, UBS_USE useIn);
61 
65  ~UbpCplex();
66 
67  private:
77  virtual SUBSOLVER_RETCODE _solve_nlp(const std::vector<double> &lowerVarBounds, const std::vector<double> &upperVarBounds, double &objectiveValue, std::vector<double> &solutionPoint);
78 
82  void _terminate_cplex();
83 
88  IloEnv cplxEnv;
89  IloModel cplxModel;
90  IloNumVarArray cplxVars;
91  IloCplex cplex;
94  // Prevent use of default copy constructor and copy assignment operator by declaring them private:
95  UbpCplex(const UbpCplex &);
96  UbpCplex &operator=(const UbpCplex &);
97 };
98 
99 
100 } // end namespace ubp
101 
102 
103 } // end namespace maingo
Struct for storing settings for MAiNGO.
Definition: settings.h:143
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 (actually, LP in this case) sub-problem.
Wrapper for handling the upper bounding problems by interfacing CPLEX.
Definition: ubpCplex.h:41
This class contains all logging and output information.
Definition: logger.h:100
IloCplex cplex
Definition: ubpCplex.h:91
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
namespace holding all essentials of MAiNGO
Definition: aleModel.h:31
UBS_USE
Enum for communicating what the intended purpose of the solver is. This determines which settings are...
Definition: ubp.h:56
UbpCplex(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.
IloModel cplxModel
Definition: ubpCplex.h:89
void _terminate_cplex()
Function for taking care of memory management by terminating Cplex (either called from destructor or ...
UbpCplex & operator=(const UbpCplex &)
IloEnv cplxEnv
Definition: ubpCplex.h:88
IloNumVarArray cplxVars
Definition: ubpCplex.h:90
~UbpCplex()
Destructor.