MAiNGO
aleModel.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 aleModel.h
11  *
12  * @brief File containing the AleModel specialization of MAiNGModel needed for the
13  * ALE parser.
14  *
15  **********************************************************************************/
16 
17 #pragma once
18 
19 #include "MAiNGOmodel.h"
20 #include "exceptions.h"
21 #include "program.h"
22 
23 #include "symbol_table.hpp"
24 
25 #include <unordered_map>
26 
27 
28 using Var = mc::FFVar;
29 
30 
31 namespace maingo {
32 
37 class AleModel: public MAiNGOmodel {
38 
39  public:
45  EvaluationContainer evaluate(const std::vector<Var>& optVars);
46 
53  AleModel(Program prog, ale::symbol_table& symbols):
54  _prog(prog), _symbols(symbols)
55  {
57  };
58 
62  std::vector<OptimizationVariable> get_variables();
63 
67  const std::unordered_map<std::string, int>& get_positions();
68 
72  std::vector<double> get_initial_point();
73 
77  void make_variables();
78 
79  private:
81  ale::symbol_table& _symbols;
83  std::vector<OptimizationVariable> _variables;
84  std::vector<double> _initials;
85  std::unordered_map<std::string, int> _positions;
86 };
87 
88 
89 } // namespace maingo
ale::symbol_table & _symbols
Definition: aleModel.h:81
std::vector< OptimizationVariable > get_variables()
Function for getting optimization variables data.
Definition: aleModel.cpp:32
std::vector< double > get_initial_point()
Function for getting initial point data.
Definition: aleModel.cpp:50
mc::FFVar Var
Definition: aleModel.h:28
Container Class for ALE expressions comprising an optimization problem.
Definition: program.h:29
Struct for storing the values returned by model evaluation at the given point "var".
Definition: evaluationContainer.h:192
void make_variables()
Function for populating _variables, _initials, and _positions.
Definition: aleModel.cpp:96
std::vector< double > _initials
Definition: aleModel.h:84
This class is the base class for models to be solved by MAiNGO.
Definition: MAiNGOmodel.h:91
This class provides the interface for a program composed of ALE expressions.
Definition: aleModel.h:37
EvaluationContainer evaluate(const std::vector< Var > &optVars)
Main function used to evaluate the model and construct a directed acyclic graph.
Definition: aleModel.cpp:59
namespace holding all essentials of MAiNGO
Definition: aleModel.h:31
Program _prog
Definition: aleModel.h:80
std::unordered_map< std::string, int > _positions
Definition: aleModel.h:85
std::vector< OptimizationVariable > _variables
Definition: aleModel.h:83
const std::unordered_map< std::string, int > & get_positions()
Function for getting optimization variable position data.
Definition: aleModel.cpp:41
AleModel(Program prog, ale::symbol_table &symbols)
Constructor taking a ALE-based Program and an ALE symbol_table.
Definition: aleModel.h:53