This repository contains a Python script (run.py) designed to perform a systematic analysis of a set of instances using the TIMES source code. The script processes instance data, generates benchmark statistics, and compares results against a ground truth from a previous run.
-
Clone the repository:
git clone https://github.com/yourusername/yourrepository.git cd yourrepository -
Ensure you have Python installed (Python 3.6 or higher).
-
Install necessary dependencies:
pip install -r requirements.txt
-
Choose a Solve Mode: Choose your
solvemodefromSOLVE:- Runs and solves all instances and generates a savepoint file
TIMES_p.gdxin the output directory. - The savepoint file contains the information on the current solution point can be used to skip the solve of a future run to save time.
- Runs and solves all instances and generates a savepoint file
LOADSOLUTION:- Requires a savepoint file (
TIMES_p.gdx) in the output directory. - Loads information from a previous solve instead of resolving the model.
- Requires a savepoint file (
-
Prepare Instance Data: Place your instance data into subfolders within the
datadirectory. Each subfolder should contain the relevant data for an instance.Add all instances you want to analyze to the
instanceslist where each tuple contains(<folder_name>,<run_file>):instances = [ ("Instance_1", "Instance_1.RUN"), ("Instance_2", "Instance_2.RUN"), ]
-
Specify TIMES Source Code Location: In the
run.pyscript, set the path to the TIMES source code. Modify the following line:TIMES_SOURCE_PATH = '/path/to/times/source'
-
Run the Script: Execute the script to start the analysis:
python run.py
run.py: The main script for performing the analysis.summarize_results.py: Script for analyzing output files and writing statistics.data/: Directory where instance data subfolders are placed.output/: Directory where log and profile files are written.ground_truth_result_overview.csv: CSV file containing results from a previous run for comparison.results_overview.csv: CSV file containing results from the latest run ofrun.py.results.md: Markdown file generated with benchmark statistics and analysis. Comparesground_truth_result_overview.csvandresults_overview.csv.
Ensure the following configurations are set in run.py before running the script:
TIMES_SOURCE_PATH: Path to the TIMES source code.- Data directory structure should be maintained as specified.
instances: List of tuples containing instances subject to analyses.solvemode: Mode of solving (solve vs skip solve)
The script generates several outputs:
- .log, .lst and Profile Files: Written to subfolders within the
outputdirectory. - Comparison to Ground Truth: A markdown file (
results.md) with statistics on all analyzed results. - Benchmark Results: A CSV file (
results_overview.csv) containing statistics from the latest run. - Profile Summary: A markdown file (
profile_summary.md) with detailed run times for GAMS assignments or equations.
Contributions are welcome! Please follow these steps to contribute:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature). - Commit your changes (
git commit -m 'Add your feature'). - Push to the branch (
git push origin feature/your-feature). - Open a Pull Request.
Feel free to reach out if you have any questions or need further assistance!
Happy analyzing!