Skip to content

Commit

Permalink
[iss-81]
Browse files Browse the repository at this point in the history
  • Loading branch information
Kalashnikovni committed Feb 13, 2025
1 parent 0ddb25f commit fe94bcf
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 20 deletions.
Binary file modified 3rd-party/sbg/sb-graph-1.0.0.tar.gz
Binary file not shown.
10 changes: 7 additions & 3 deletions CHANGELOG.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Empty file modified Doxyfile
100644 → 100755
Empty file.
Empty file modified INSTALL
100644 → 100755
Empty file.
Empty file modified LICENSE
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion Makefile.in
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 26 additions & 2 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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.
Expand All @@ -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++
Expand All @@ -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)
Expand Down
26 changes: 13 additions & 13 deletions causalize/sbg_implementation/generate_sbg_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down Expand Up @@ -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();
}

Expand Down
2 changes: 1 addition & 1 deletion causalize/sbg_implementation/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 +
Expand Down
Empty file modified compile_commands.json
100644 → 100755
Empty file.
Empty file modified configure.ac
100644 → 100755
Empty file.
Empty file modified configure.in
100644 → 100755
Empty file.

0 comments on commit fe94bcf

Please sign in to comment.