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  **********************************************************************************/
11 
12 #pragma once
13 
14 #include "MAiNGOmodel.h"
15 #include "program.h"
16 
17 #include "symbol_table.hpp"
18 
19 #include <unordered_map>
20 
21 
22 using Var = mc::FFVar;
23 
24 
25 namespace maingo {
26 
31 class AleModel: public MAiNGOmodel {
32 
33  public:
39  EvaluationContainer evaluate(const std::vector<Var>& optVars);
40 
47  AleModel(Program prog, ale::symbol_table& symbols):
48  _prog(prog), _symbols(symbols)
49  {
51  };
52 
56  std::vector<OptimizationVariable> get_variables();
57 
61  const std::unordered_map<std::string, int>& get_positions();
62 
66  std::vector<double> get_initial_point();
67 
71  void make_variables();
72 
73  private:
75  ale::symbol_table& _symbols;
77  std::vector<OptimizationVariable> _variables;
78  std::vector<double> _initials;
79  std::unordered_map<std::string, int> _positions;
80 };
81 
82 
83 } // namespace maingo
ale::symbol_table & _symbols
Definition: aleModel.h:75
std::vector< OptimizationVariable > get_variables()
Function for getting optimization variables data.
Definition: aleModel.cpp:27
std::vector< double > get_initial_point()
Function for getting initial point data.
Definition: aleModel.cpp:45
mc::FFVar Var
Definition: aleModel.h:22
Container Class for ALE expressions comprising an optimization problem.
Definition: program.h:24
Struct for storing the values returned by model evaluation at the given point "var".
Definition: evaluationContainer.h:208
void make_variables()
Function for populating _variables, _initials, and _positions.
Definition: aleModel.cpp:94
std::vector< double > _initials
Definition: aleModel.h:78
This class is the base class for models to be solved by MAiNGO.
Definition: MAiNGOmodel.h:87
This class provides the interface for a program composed of ALE expressions.
Definition: aleModel.h:31
EvaluationContainer evaluate(const std::vector< Var > &optVars)
Main function used to evaluate the model and construct a directed acyclic graph.
Definition: aleModel.cpp:54
namespace holding all essentials of MAiNGO
Definition: aleModel.h:25
Program _prog
Definition: aleModel.h:74
std::unordered_map< std::string, int > _positions
Definition: aleModel.h:79
std::vector< OptimizationVariable > _variables
Definition: aleModel.h:77
const std::unordered_map< std::string, int > & get_positions()
Function for getting optimization variable position data.
Definition: aleModel.cpp:36
AleModel(Program prog, ale::symbol_table &symbols)
Constructor taking a ALE-based Program and an ALE symbol_table.
Definition: aleModel.h:47