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  **********************************************************************************/
11 
12 #pragma once
13 
14 #include "ubp.h"
15 
16 #include "ilcplex/ilocplex.h"
17 
18 #include <list>
19 #include <utility>
20 
21 
22 namespace maingo {
23 
24 
25 namespace ubp {
26 
27 
36 
37  public:
53  UbpCplex(mc::FFGraph &DAG, const std::vector<mc::FFVar> &DAGvars, const std::vector<mc::FFVar> &DAGfunctions, const std::vector<babBase::OptimizationVariable> &variables,
54  const unsigned nineqIn, const unsigned neqIn, const unsigned nineqSquashIn, std::shared_ptr<Settings> settingsIn, std::shared_ptr<Logger> loggerIn, std::shared_ptr<std::vector<Constraint>> constraintPropertiesIn, UBS_USE useIn);
55 
60 
61  private:
71  virtual SUBSOLVER_RETCODE _solve_nlp(const std::vector<double> &lowerVarBounds, const std::vector<double> &upperVarBounds, double &objectiveValue, std::vector<double> &solutionPoint);
72 
76  void _terminate_cplex();
77 
82  IloEnv cplxEnv;
83  IloModel cplxModel;
84  IloNumVarArray cplxVars;
85  IloCplex cplex;
88  // Prevent use of default copy constructor and copy assignment operator by declaring them private:
89  UbpCplex(const UbpCplex &);
90  UbpCplex &operator=(const UbpCplex &);
91 };
92 
93 
94 } // end namespace ubp
95 
96 
97 } // end namespace maingo
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:35
IloCplex cplex
Definition: ubpCplex.h:85
Base class for wrappers for handling the upper bounding problems.
Definition: ubp.h:44
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
UBS_USE
Enum for communicating what the intended purpose of the solver is. This determines which settings are...
Definition: ubp.h:51
IloModel cplxModel
Definition: ubpCplex.h:83
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, std::shared_ptr< Settings > settingsIn, std::shared_ptr< Logger > loggerIn, std::shared_ptr< std::vector< Constraint >> constraintPropertiesIn, UBS_USE useIn)
Constructor, stores information on the problem and initializes the local-subsolvers used...
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:82
IloNumVarArray cplxVars
Definition: ubpCplex.h:84
~UbpCplex()
Destructor.
Definition: ubpCplex.h:59