https://github.com/cubewise-code/optimus-py
Find the best cube dimension order with TM1py
https://github.com/cubewise-code/optimus-py
planning-analytics tm1 tm1-rest-api tm1py
Last synced: 4 months ago
JSON representation
Find the best cube dimension order with TM1py
- Host: GitHub
- URL: https://github.com/cubewise-code/optimus-py
- Owner: cubewise-code
- License: mit
- Created: 2019-12-16T21:58:41.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2025-12-15T09:29:09.000Z (6 months ago)
- Last Synced: 2026-02-02T03:33:20.000Z (5 months ago)
- Topics: planning-analytics, tm1, tm1-rest-api, tm1py
- Language: Python
- Homepage:
- Size: 1.01 MB
- Stars: 19
- Watchers: 9
- Forks: 18
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# OptimusPy for TM1
Find the ideal dimension order for your TM1 cubes
## Installing
Install required python packages:
```
pip install TM1py
pip install seaborn
```
Clone or download the `optimus-py` Repository from GitHub
## Usage
* Adjust config.ini to match your TM1 environment
* Create uniquely named views in the relevant cubes
* Execute the `optimuspy.py`
* provide 8 arguments:
-i _(name of the instance)_
-c _(name of the cube)_
-v _(name of the cube view)_
-e _(number of execution)_
-f _(fast mode: True or False)_
-o _(output: csv or xlsx)_
-u _(update original order: True or False)_
-t _(name of a ti process to measure runtime)_
-d _(optional: comma split list of dimensions to keep positions as per the storage order)_
```
C:\Projects\optimus-py\optimuspy.py -i="tm1srv01" -c="Cube Name" -v="Optimus" -e="10" -f="True" -o="csv" -u=True -t="load.csv.file"
```
```
C:\Projects\optimus-py\optimuspy.py --instance="tm1srv01" --cube="Cube Name" --view="Optimus" --executions="15" --fast="True" --output="csv" --update=True --process="load.csv.file"
```
You can use this public Google Sheet to construct the command prompt for the execution
https://docs.google.com/spreadsheets/d/1dtgl9WkYcsyokWNdX29m4K_5oNm3MI3iTOH2f_g6Kd4/edit?usp=sharing
## Output
OptimusPy determines the ideal dimension order for every cube, based on RAM and query speed.
For traceability and custom analysis, Optimus visualizes the results in a csv report and a scatter plot per cube.
|ID |Mode |Mean Query Time|RAM |Dimension1 |Dimension2 |Dimension3 |Dimension4 |Dimension5 |Dimension6 |Dimension7|Dimension8|Dimension9 |
|---|--------------|---------------|------|-------------|------------|------------|------------|-------------|------------|----------|----------|-------------|
|1 |Original Order|0.00445528 |259072|Industry |SalesMeasure|Product |Executive |Business Unit|Customer |Version |State |Time |
|2 |Iterations |0.00379407 |520184|SalesMeasure |Customer |Executive |Industry |Product |State |Time |Version |Business Unit|
|3 |Iterations |0.00378995 |520184|Business Unit|SalesMeasure|Executive |Industry |Product |State |Time |Version |Customer |
|4 |Iterations |0.00422788 |520184|Business Unit|Customer |SalesMeasure|Industry |Product |State |Time |Version |Executive |
|5 |Iterations |0.00458372 |520184|Business Unit|Customer |Executive |SalesMeasure|Product |State |Time |Version |Industry |
|6 |Iterations |0.00479290 |259072|Business Unit|Customer |Executive |Industry |SalesMeasure |State |Time |Version |Product |
|7 |Iterations |0.00548539 |259072|Business Unit|Customer |Executive |Industry |Product |SalesMeasure|Time |Version |State |

## Considerations
- Ideally run on the same machine as TM1
- Use big and representative views _(e.g. typical slices that end users consume)_
- Choose a sensible number of `executions` between 5 and 10
- Provide enough spare memory on TM1 server
- Fast mode determines first and last position only _(Should get you 80% of possible improvement potential)_
- XLSX output is preferable over CSV output but requires optional `xlsxwrite` dependency
- Choose a TI that loads data to the cube and runs for at least a few seconds
## Need a .exe version of OptimusPy?
The latest executable build is available as an artifact in the GitHub Actions workflow runs. To download it:
1. Go to the [Actions tab](https://github.com/cubewise-code/optimus-py/actions) of the repository.
2. Click on the most recent workflow run titled **Build Executable**.
3. In the workflow summary, look for the **Artifacts** section.
4. Download the **optimuspy-winOS** artifact.
## Built With
* [TM1py](https://github.com/cubewise-code/TM1py) - A python wrapper for the TM1 REST API
* [matplotlib](https://github.com/matplotlib/matplotlib) - A comprehensive library for crating visualizations in Python.
## License
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details