diff --git a/3rd-party/sbg/sb-graph-1.0.0.tar.gz b/3rd-party/sbg/sb-graph-1.0.0.tar.gz index 0bf8555..1663012 100644 Binary files a/3rd-party/sbg/sb-graph-1.0.0.tar.gz and b/3rd-party/sbg/sb-graph-1.0.0.tar.gz differ diff --git a/CHANGELOG.md b/CHANGELOG.md old mode 100644 new mode 100755 index 158a484..d59c11f --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,14 @@ # Changelog -## [Unreleased] +## [4.0] - 2022-05-04 +### Added +- Implemented SBGraphs as an independent library. +- Implemented **new matching** algorithm based on **SBGraphs**. +## [3.0] - 2021-08-20 ### Added -- Implemented SBGraphs data structures and helper clases, for details see [**graph definition**](https://github.com/CIFASIS/modelicacc/tree/SBGraphs/util/graph) -- Implemented **new flatter** algorithm based on **SBGraphs** +- Implemented SBGraphs data structures and helper classes. +- Implemented **new flatter** algorithm based on **SBGraphs**. ## [2.0] - 2020-11-17 ### Added diff --git a/Doxyfile b/Doxyfile old mode 100644 new mode 100755 diff --git a/INSTALL b/INSTALL old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/Makefile.in b/Makefile.in old mode 100644 new mode 100755 index d67403b..b114e1f --- a/Makefile.in +++ b/Makefile.in @@ -77,7 +77,7 @@ ifeq ("$(wildcard $(BOOST_LIB_PATH)/$(BOOST_1_81))","") endif update-sbg: - cd $(3RD_PARTY_DIR)/$(SBG_LIB); ./update.py --branch_name $(sbg_branch) --repo_checkout $(repo_checkout) + cd $(3RD_PARTY_DIR)/$(SBG_LIB); python3 ./update.py --branch_name $(sbg_branch) --repo_checkout $(repo_checkout) cd $(3RD_PARTY_DIR)/$(SBG_LIB); tar -zxvf $(SBG_DEV).tar.gz lib-sbg: lib-boost diff --git a/README.md b/README.md old mode 100644 new mode 100755 index 7369cd0..56e0190 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ ModelicaCC is a Modelica C Compiler implemented in C++, the main goal of this pr * Index Reduction * Sorting * Code Generation - * Simulation Model + * Model Simulation The input/output of each stage are valid Modelica models (except for the very last stage which produce C code). Each stage converts the Modelica model fed as input into a “simpler” equivalent one. As the compiler uses the [QSS Solver](https://github.com/CIFASIS/qss-solver) for the C code generation and simulation, the goal of the previous stages is to obtain a valid μ–Modelica model. @@ -29,6 +29,12 @@ Proceedings of the 11th International Modelica Conference 2015 **Set-based graph methods for fast equation sorting in large DAE systems** EOOLT '19: Proceedings of the 9th International Workshop on Equation-based Object-oriented Modeling Languages and Tools 2019 +[3] Denise Marzorati, Joaquín Fernández, and Ernesto Kofman. 2024. Efficient Matching in Large DAE Models. ACM Trans. Math. Softw. Just Accepted (June 2024). https://doi.org/10.1145/3674831 + +[4] Denise Marzorati, Joaquin Fernández, Ernesto Kofman. Connected Components in Undirected Set--Based Graphs. Applications in Object--Oriented Model Manipulation Applied Mathematics and Computation, Volume 418, 2022, 126842,ISSN 0096-3003, https://doi.org/10.1016/j.amc.2021.126842. + +[5] Ernesto Kofman, Joaquín Fernández, Denise Marzorati. Compact sparse symbolic Jacobian computation in large systems of ODEs Applied Mathematics and Computation, Volume 403, 2021, 126181, ISSN 0096-3003, https://doi.org/10.1016/j.amc.2021.126181. + ## Installation These are generic installation instructions. @@ -39,7 +45,7 @@ In order to be able to install and compile ModelicaCC, the following dependencies must be installed: * autoconf 2.69 (avoid 2.71) - * boost1.71 + * boost1.81 * cmake * doxygen * g++ @@ -61,9 +67,27 @@ The simplest way to compile this package is: 4. You can remove the program binaries and object files from the source code directory by typing `make clean`. +## SBG library instructions + +To use the newest versions of SBG algorithms type `make update-sbg`, and +then re-compile binaries by typing `make`. This is done automatically the +first time the whole project is built. + +If Python3 is not installed, replace the occurrences of `python3` with +`python`. ## Changelog +## [4.0] - 2022-05-04 +### Added +- Implemented SBGraphs as an independent library. As such, new algorithms +for causalization will be listed in its corresponding repository. + +## [3.0] - 2021-08-20 +### Added +- Implemented SBGraphs data structures and helper classes. +- Implemented **new flatter** algorithm based on **SBGraphs**. + ## [2.0] - 2020-11-17 ### Added - Implemented vector graph [**data structures**](https://github.com/CIFASIS/modelicacc/blob/modelicacc-dev/causalize/vg_implementation/vector/vector_graph_definition.h) diff --git a/causalize/sbg_implementation/generate_sbg_input.cpp b/causalize/sbg_implementation/generate_sbg_input.cpp index 15db2a0..ba04bfd 100644 --- a/causalize/sbg_implementation/generate_sbg_input.cpp +++ b/causalize/sbg_implementation/generate_sbg_input.cpp @@ -152,7 +152,7 @@ void GenerateSBGInput::addOffset(int edge_id, const std::string& map, int offset off_def << " - " << offset; } def << "off" << map << edge_id << dim_name.str() << " = " - << "r(V" << v_id - 1 << ",1) - r(E" << edge_id - 1 << ",1)" << off_def.str(); + << "V" << v_id - 1 << " - E" << edge_id - 1 << off_def.str(); _offsets.push_back(def.str()); } @@ -328,49 +328,49 @@ void GenerateSBGInput::buildFromModel() void GenerateSBGInput::generateEdgeMap(const std::string& map_name, const std::string& map_idx, bool fixed_slopes) { - _sbg_input << map_name << " %= <<"; + _sbg_input << map_name << ": <<"; unsigned long size = 1; for (std::string def : _E) { int slope = fixed_slopes ? 1 : _m1_slopes[size - 1]; _sbg_input << "{" << def << "} -> " << slope << "*x+off" << map_idx << size << ((size < _E.size()) ? " , " : ""); size++; } - _sbg_input << ">>;" << std::endl; + _sbg_input << ">>" << std::endl; } void GenerateSBGInput::generateSBGInput() { for (std::string def : _offsets) { - _sbg_input << def << std::endl; + _sbg_input << def << ";" << std::endl; } _sbg_input << std::endl; _sbg_input << "matchSCCTS(" << std::endl; - _sbg_input << "V %= {"; + _sbg_input << "V: {"; unsigned long size = 1; for (std::string def : _V) { - _sbg_input << def << ((size < _V.size()) ? " , " : ""); + _sbg_input << def << ((size < _V.size()) ? ", " : ""); size++; } - _sbg_input << "};" << std::endl; + _sbg_input << "}" << std::endl; - _sbg_input << "Vmap %= <<"; + _sbg_input << "Vmap: <<"; size = 1; for (std::string def : _V) { - _sbg_input << "{" << def << "} -> 0*x+" << size << ((size < _V.size()) ? " , " : ""); + _sbg_input << "{" << def << "} -> 0*x+" << size << ((size < _V.size()) ? ", " : ""); size++; } - _sbg_input << ">>;" << std::endl; + _sbg_input << ">>" << std::endl; generateEdgeMap("map1", "M1"); const bool FIXED_SLOPES = true; generateEdgeMap("map2", "M2", FIXED_SLOPES); - _sbg_input << "Emap %= <<"; + _sbg_input << "Emap: <<"; size = 1; for (std::string def : _E) { _sbg_input << "{" << def << "} -> 0*x+" << size << ((size < _E.size()) ? " , " : ""); size++; } - _sbg_input << ">>;" << std::endl; - _sbg_input << ", 1)" << std::endl; + _sbg_input << ">>" << std::endl; + _sbg_input << ", 1);" << std::endl; _sbg_input.close(); } diff --git a/causalize/sbg_implementation/main.cpp b/causalize/sbg_implementation/main.cpp index 2c714da..1db16de 100644 --- a/causalize/sbg_implementation/main.cpp +++ b/causalize/sbg_implementation/main.cpp @@ -113,7 +113,7 @@ int main(int argc, char** argv) gen_sbg_input.buildFromModel(); /// Temp hack to test the binaries, hardcoded paths should go on config files. - const std::string CAUSALIZE = "../3rd-party/sbg/sb-graph-dev/bin/sbg-eval "; + const std::string CAUSALIZE = "./3rd-party/sbg/sb-graph-dev/bin/sbg-eval "; const std::string DEFAULT_CAUSALIZED_JSON = "./output.json"; const std::string CAUSALIZED_JSON = mmo_class.name() + "_causalized.json"; std::string ARGS = "-f " + gen_sbg_input.fileName() + " > " + mmo_class.name() + "_causalized.sbg; mv " + DEFAULT_CAUSALIZED_JSON + diff --git a/compile_commands.json b/compile_commands.json old mode 100644 new mode 100755 diff --git a/configure.ac b/configure.ac old mode 100644 new mode 100755 diff --git a/configure.in b/configure.in old mode 100644 new mode 100755