Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
149 commits
Select commit Hold shift + click to select a range
9a73444
added ruby to conda env, made setup scripts
Grochocinski Jan 29, 2025
bdd82c2
Removed unnecessary version specifiers, changed support to current Py…
Grochocinski Feb 5, 2025
5ea1a19
Updated year in copyright notice
Grochocinski Feb 5, 2025
7ea57d5
Updated directions to reflect new setup process
Grochocinski Feb 5, 2025
9375398
fixed table formatting
Grochocinski Feb 5, 2025
06ee1c3
add a citation file
Grochocinski Feb 5, 2025
0adf80a
Changed author ordering to match README
Grochocinski Feb 5, 2025
de819f7
Revised README to use new citation process
Grochocinski Feb 5, 2025
b89d0d8
Added Ruff to dev environment
Grochocinski Feb 10, 2025
0f89b92
Add pillow to environment
Grochocinski Feb 10, 2025
91b5bd6
dropped support for Ruby via WSL (now installed via Conda)
Grochocinski Feb 10, 2025
4240c93
fixed formatting
Grochocinski Feb 10, 2025
a3325d7
Merge pull request #144 from simopt-admin/setup_streamlining
Grochocinski Feb 10, 2025
e66e0ca
transitioned testing results to Pickle file for better automated test…
Grochocinski Feb 10, 2025
1cad3de
partial refactoring
Grochocinski Feb 14, 2025
e109cd9
changed to yaml for test generation, fixed bug where tests would rege…
Grochocinski Feb 19, 2025
3a404bb
Changed summary statistics to be computed upon demand instead of afte…
Grochocinski Feb 20, 2025
68aa3ca
astrodf now uses exact inverse where possible, general refactoring
Grochocinski Feb 21, 2025
d9dfbbe
Reimplemented tests using yaml to store expected values
Grochocinski Feb 21, 2025
786c45c
Rounded objective/gradient stats to 15 decimal places to reduce chanc…
Grochocinski Feb 21, 2025
0675a9b
fixed formatting
Grochocinski Feb 21, 2025
36144a2
removed unused return statement
Grochocinski Feb 21, 2025
75178ac
Merge pull request #145 from simopt-admin/reimplement_testing
Grochocinski Feb 21, 2025
457ebcd
move testing utils into dev_tools folder
Grochocinski Feb 26, 2025
4fc57d2
Add logging to GUI and solver classes for improved debugging
Grochocinski Feb 26, 2025
5919b36
Refactor logging statements to use debug and warning levels for bette…
Grochocinski Mar 5, 2025
28877f9
initial profiling tool code
Grochocinski Mar 5, 2025
3bcf582
Refactored Curve class to increase efficiency, implemented some local…
Grochocinski Mar 5, 2025
b418a23
moved Curve and related functionality out of experiment_base
Grochocinski Mar 5, 2025
16483d5
accidentally commited prerelease mrg32k3a instead of experiment_base …
Grochocinski Mar 5, 2025
191a688
updated gitignore to prevent committing prerelease mrg323ka builds in…
Grochocinski Mar 5, 2025
081a034
removed old experiment_window gui file
Grochocinski Mar 5, 2025
993ee26
Refactored solver properties to class methods for improved performanc…
Grochocinski Mar 5, 2025
698b9f0
Enhance class property support with type hints and PEP8 naming conven…
Grochocinski Mar 5, 2025
a91d954
fixed error where n_stochastic_constraints was improperly marked as a…
Grochocinski Mar 5, 2025
b19b0d9
removed instantiation of problems/solvers for the purpose of name res…
Grochocinski Mar 5, 2025
f3e77bb
Merge pull request #146 from simopt-admin/profiling
Grochocinski Mar 5, 2025
434c335
reorganized documentation structure to match standard layout
Grochocinski Mar 5, 2025
c3f4b22
add github workflow to automatically build documentation
Grochocinski Mar 5, 2025
e52259e
fixed formatting
Grochocinski Mar 5, 2025
c626c22
Merge pull request #147 from simopt-admin/refactor_docs
Grochocinski Mar 5, 2025
adf7067
switched sphinx workflow to conda environment
Grochocinski Mar 5, 2025
d5a18f6
Merge pull request #148 from simopt-admin/refactor_docs
Grochocinski Mar 5, 2025
3d32f4c
Refactor ASTRODF solver to use instance variables for iteration manag…
Grochocinski Mar 8, 2025
fc558d5
Refactor ASTRODF solver to encapsulate initialization logic in a dedi…
Grochocinski Mar 8, 2025
cdb2e61
Removed name adaptation for the new iterate function layout
Grochocinski Mar 8, 2025
26833ec
changed error handling for divide by zero in hessian updates, updated…
Grochocinski Mar 8, 2025
3335216
partial refactoring of construct_model
Grochocinski Mar 8, 2025
11ba4a8
refactored out interpolation point logic into a separate function
Grochocinski Mar 9, 2025
95e0980
refactored out adaptive sampling functionality into a common method
Grochocinski Mar 9, 2025
8b3d539
refactored iterate to also use adaptive sampling method
Grochocinski Mar 9, 2025
d7743d9
refactored out hessian update functionality, changed handling of DB0 …
Grochocinski Mar 9, 2025
5e0545d
fixed matrix deprecation warning and error message handling
Grochocinski Mar 10, 2025
cfbe894
Improved handling of divide by zero errors in SPSA
Grochocinski Mar 10, 2025
e1c80b6
changed post norm db0 handling to use epsilon
Grochocinski Mar 10, 2025
92a6bb0
refactored out make_nonzero functionality into utils module, implemen…
Grochocinski Mar 10, 2025
69cdea6
fixed docstring for make_nonzero, fixed indexing in strong, regenerat…
Grochocinski Mar 10, 2025
ec6f591
update post_normalize to use make_nonzero()
Grochocinski Mar 10, 2025
f10f2f3
Merge pull request #149 from simopt-admin/astrodf_refactor
Grochocinski Mar 10, 2025
f8d8477
Merge pull request #150 from simopt-admin/improve_db0_handling
Grochocinski Mar 10, 2025
adc6003
modified ADAM solve() to use np's vectorization
Grochocinski Mar 10, 2025
b46aaac
refactored finite_diff helper to take advantage of np vectorization
Grochocinski Mar 10, 2025
fd9dbcf
changed ALOE's solve() to use np's vectorized operations
Grochocinski Mar 10, 2025
bd082ea
vectorized ALOE's finite_diff helper
Grochocinski Mar 10, 2025
1f6d870
added finite_diff docstring, changed solution simulation loop to be m…
Grochocinski Mar 11, 2025
9841859
removed inline comments causing statements to run over 80 characters
Grochocinski Mar 11, 2025
f9ae0cc
refactored NelderMead's helper functions for better vectorization and…
Grochocinski Mar 11, 2025
85b1fe9
refactored neldmd's solve() function
Grochocinski Mar 11, 2025
5c1e005
removed repeated casting of bounds to/from np arrays
Grochocinski Mar 11, 2025
4bdd2eb
fixed type hints, removed unnecessary tuple casts, simplified minimiz…
Grochocinski Mar 11, 2025
d0c2d77
refactored helper functions and solve function for improved vectoriza…
Grochocinski Mar 13, 2025
f9bcec2
partial STRONG refactor to avoid recomputation of values
Grochocinski Mar 13, 2025
169e985
refactored to reduce repeated code and improve clarity
Grochocinski Mar 13, 2025
183e5b4
refactored finite diff to remove large if block
Grochocinski Mar 13, 2025
ecd2df5
fixed bug in STRONG hessian calculation where x6 solution was based o…
Grochocinski Mar 13, 2025
c8d2b5e
refactored finite_diff to reduce duplicate code
Grochocinski Mar 14, 2025
7b30f6a
replaced create_profiles script with improved run_experiment for use …
Grochocinski Mar 17, 2025
4e96948
moved valid pair generation out of main method
Grochocinski Mar 17, 2025
ec2f433
Remove Sphinx Workflow
Grochocinski Mar 17, 2025
de9d940
moved method checks outside of loop to avoid repetitive checks
Grochocinski Mar 17, 2025
bb92768
replaced map_async with imap_unordered to reduce busy waiting
Grochocinski Mar 18, 2025
97e194f
refactored solve function to reduce repeat code and improve clarity
Grochocinski Mar 18, 2025
274e616
rolled tests back to using mrg32k3a v1.0.2 due to issues with v1.1 pr…
Grochocinski Mar 19, 2025
9ad3444
regenerated tests with new mrg32k3a v1.1 prerelease (mostly minor rou…
Grochocinski Mar 19, 2025
faddf8d
fixed formatting
Grochocinski Mar 19, 2025
66a39b7
updated run_experiment script with some documentation and correct han…
Grochocinski Mar 20, 2025
51f16db
updated test results (again)
Grochocinski Mar 20, 2025
736f27b
refactored experiment testing files into a single dynamic-generation …
Grochocinski Mar 22, 2025
bead9be
move experiment result generator script and gave it a more descriptiv…
Grochocinski Mar 22, 2025
a8eec60
fixed type errors in exp test core
Grochocinski Mar 22, 2025
11a7143
greatly simplified multi-level indexing handling and improved error m…
Grochocinski Mar 22, 2025
afdd6e3
changed curve comparisons for better high-value accuracy
Grochocinski Mar 22, 2025
b11da5c
fixed typing issues with @classproperty
Grochocinski Mar 24, 2025
ff59f32
fixed typing issues with objective properties
Grochocinski Mar 24, 2025
a559f7a
fixed return types not matching np.ndarray
Grochocinski Mar 24, 2025
5482376
added fast weighted chocies, completion min caching, general refactoring
Grochocinski Mar 24, 2025
ff008a8
fixed Probs/Solvs/Mods being specified instead of child types
Grochocinski Mar 24, 2025
e4bc65d
added fallback for devices where cpu_count() can't be determined
Grochocinski Mar 24, 2025
ef7c5dc
added missing make_nonzero function
Grochocinski Mar 24, 2025
b93f9ab
fixed formatting
Grochocinski Mar 24, 2025
3d1d188
tweaked return type of stoch_constraint functions for consistency
Grochocinski Mar 24, 2025
ba24d6e
fixed invalid ndarray type hint, fixed unclear solution_value type
Grochocinski Mar 24, 2025
c12fc33
formalized variables as properties, fixed typing issues
Grochocinski Mar 24, 2025
dfdea4d
fixed formatting issues, added imports to Ruff checking
Grochocinski Mar 24, 2025
36a1863
fixed import formatting
Grochocinski Mar 24, 2025
c3ac534
fixed typing issues
Grochocinski Mar 24, 2025
1e00922
fixed attempted sorts without a rich comparison type
Grochocinski Mar 24, 2025
e5417a2
fixed formatting for remaining files
Grochocinski Mar 24, 2025
696ac31
regenerated test files affected by "final" mrg32k3a v1.1 behavior cha…
Grochocinski Mar 24, 2025
8162278
added override to Ruff for which imports should be considered first-p…
Grochocinski Mar 24, 2025
4a6c341
fixed typing errors in demos, fixed related typing errors in other files
Grochocinski Mar 24, 2025
5912b6c
changed infinity checks to math.isinf(), fixed docstring return descr…
Grochocinski Mar 25, 2025
9045a92
simplified flow of replication loop
Grochocinski Mar 25, 2025
096c557
added note about unused total_diff attribute
Grochocinski Mar 25, 2025
8d44ab6
refactored replicate() to be streamlined and easier to follow
Grochocinski Mar 26, 2025
d537e72
refactored replicate() to make contam calculation clearer
Grochocinski Mar 26, 2025
4623deb
refactored replicate to remove repeated numpy array creation/destruct…
Grochocinski Mar 26, 2025
74fa818
refactored replicate() for clearer gumbel and utility inits, clearer …
Grochocinski Mar 26, 2025
614ad8c
refactored replicate() with vectorized stockout calcs
Grochocinski Mar 26, 2025
77636ac
greatly simplified node-building logic in replicate()
Grochocinski Mar 26, 2025
d95b063
refactored replicate to clarify logic and simplify operations
Grochocinski Mar 26, 2025
8f18801
streamlined replicate logic
Grochocinski Mar 26, 2025
e4fe9ad
partial refactor of replicate()
Grochocinski Mar 26, 2025
59744a3
refactored replicate for improved readability
Grochocinski Mar 26, 2025
6bc8e32
vectorized replicate and added enum for matrix indexing
Grochocinski Mar 26, 2025
5c99228
made current message indexing clearer
Grochocinski Mar 26, 2025
4bbaf04
minor refactoring of replicate
Grochocinski Mar 26, 2025
e8a9015
refactored replicate for slight performance/clarity improvements
Grochocinski Mar 26, 2025
9299e82
simplified replicate logic, added fast_weighted_choice
Grochocinski Mar 27, 2025
22632dc
optimized replicate loop core + slicing logic
Grochocinski Mar 27, 2025
039ce1c
added timing printout after running methods
Grochocinski Mar 29, 2025
e5f7656
fixed #153, regenerated affected test results
Grochocinski Mar 29, 2025
59c5914
fixed #154, regenerated affected test results
Grochocinski Mar 29, 2025
85c1fcf
split ironore profit calculation into seperate costs/profits for futu…
Grochocinski Mar 29, 2025
509e165
vectorized net profic calc, regen-ed affected tests
Grochocinski Mar 29, 2025
b86fca4
replaced producing array with checks to prod_costs array
Grochocinski Mar 29, 2025
fb576c3
tweaked make_nonzero to use copysign, added message for assert in demo
Grochocinski Mar 29, 2025
12427e6
rewrote fixed_san to remove PathSegment overhead
Grochocinski Mar 31, 2025
3a7edde
regenerated some test files after ogs were generated with old MRG code
Grochocinski Mar 31, 2025
83cd3b1
Merge pull request #151 from simopt-admin/perf_enhancements
Grochocinski Mar 31, 2025
88de004
Documentation Overhaul (#156)
Grochocinski Apr 11, 2025
db727d9
minor util/docs fixes
Grochocinski Apr 16, 2025
adb354c
added TOC with external links to simopt + mrg repos
Grochocinski Apr 16, 2025
df3a601
renamed `dev_tools` folder to `utils`
Grochocinski Apr 16, 2025
fa7bdf7
changed folder name to be more accurate
Grochocinski Apr 16, 2025
b2baf68
fixed Kappa check
Grochocinski Apr 25, 2025
965cb1e
added handling for if norm(grad) == 0
Grochocinski Apr 25, 2025
ee16419
added contributor setup guide
Grochocinski Apr 30, 2025
a22ce61
bump version to 1.2
Grochocinski Jun 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
experiments/
test/test_.*.py

# mrg32k3a folder (only used during mrg32k3a co-development)
mrg32k3a/

# VS Code environment
.vscode/

Expand Down Expand Up @@ -83,6 +86,7 @@ instance/

# Sphinx documentation
docs/_build/
docs/source/autoapi/

# PyBuilder
.pybuilder/
Expand Down
5 changes: 2 additions & 3 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
version: 2

# Build from the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py
configuration: docs/source/conf.py

build:
os: ubuntu-lts-latest
tools:
python: miniconda-latest

conda:
environment: environment.yml
environment: docs/environment.yml
36 changes: 36 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: SimOpt
version: 1.2.0
message: >-
If you use this software, please cite it using the
metadata from this file
type: software
authors:
- given-names: David
family-names: Eckman
affiliation: Texas A&M University
email: eckman@tamu.edu
- email: sgh9@cornell.edu
given-names: Shane
family-names: Henderson
affiliation: Cornell University
- given-names: Sara
family-names: Shashaani
orcid: 'https://orcid.org/0000-0001-8515-5877'
affiliation: North Carolina State University
email: sshasha2@ncsu.edu
- given-names: Raghu
family-names: Pasupathy
email: pasupath@purdue.edu
affiliation: Purdue University
repository-code: 'https://github.com/simopt-admin/simopt'
url: 'https://simopt.org'
abstract: >-
SimOpt is a testbed of simulation-optimization problems
and solvers. Its purpose is to encourage the development
and constructive comparison of simulation-optimization
(SO) solvers (algorithms)
license: MIT
42 changes: 21 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
MIT License

Copyright (c) 2019 simopt-admin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
MIT License
Copyright (c) 2025 simopt-admin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
75 changes: 44 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,37 +31,59 @@ Full documentation for the source code can be found on our **[readthedocs page](

## Getting Started
### Requirements
- Python >= 3.8
- To check your Python version, open a terminal and run `python --version`. If you see a message along the lines of `Command not found`, then you likely don't have Python installed. If you know you have it installed but are getting a `Command not found` error, then you may need to [add Python to your PATH](https://realpython.com/add-python-to-path/).
- For new installs, [Miniconda or Anaconda](https://www.anaconda.com/download) is recommended ([read about the differences between Miniconda and Anaconda](https://docs.anaconda.com/distro-or-miniconda/)). If you already have a compatible IDE (such as VS Code), we've found that Miniconda will work fine at 1/10 of the size of Anaconda. It is ***highly recommended*** to check the box during installation to add Python/Miniconda/Anaconda to your system PATH.
- Ruby >= 2.5 (required for datafarming)
- Included on MacOS, but Windows users will need to grab it from [here](https://rubyinstaller.org/).
- `datafarming` gem < 2.0 (required for datafarming)
- This can be installed via `gem install datafarming -v 1.4` once Ruby is installed/configured.
- If experiencing issues, make sure that you are not using version 2.0 or later as those releases does not include the required files.
- Python packages for `numpy`, `scipy`, `matplotlib`, `pandas`, `seaborn`, `sphinx`, `mrg32k3a`, and `jupyter`.
- If using conda/miniconda, run `conda env create -f environment.yml` to create the `simopt` environment. Then run `conda activate simopt` to load the environment.
- Otherwise, run `pip install numpy scipy matplotlib pandas seaborn sphinx mrg32k3a jupyter`.
- [Miniconda or Anaconda](https://www.anaconda.com/download)
- If you already have a compatible IDE (such as VS Code), we've found that Miniconda will work fine at 1/10 of the size of Anaconda. Otherwise, you may need the Spyder IDE that comes with the full Anaconda distribution.
- [VS Code](https://code.visualstudio.com/download) (optional)
- This is a lightweight IDE that is compatible with Miniconda and is recommended for running the GUI
- [Git](https://git-scm.com/downloads) (optional)
- If you don't have Git installed, you can download the code as a zip file instead

### Downloading Source Code
There are two ways to download a copy of the source code onto your machine:
1. Download the code in a zip file by clicking the green `<> Code` button above repo contents and clicking the `Download ZIP` option, then unzip the code to a folder on your computer. This does not require `git` to be installed but makes downloading updates to the repository more challenging.
![image](https://github.com/user-attachments/assets/3c45804c-f8b0-48ed-b32c-a443550c6ef5)

3. [Clone](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) the branch you'd like to download to a folder on your computer. This requires `git` to be installed but makes downloading updates to the repository much easier.
1. [Clone](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) the branch you'd like to download to a folder on your computer. This requires `git` to be installed but makes downloading updates to the repository much easier.

If you do not need the source code for SimOpt, you may install the library as a Python package instead. See the [Package](#package) and [Basic Example](#basic-example) sections for more details about this option.

The `demo` folder contains a handful of useful scripts that can be easily modified, as directed in the comments:

| File | Description |
| ---------------------------------------- | ----------- |
| `demo_model.py` | Run multiple replications of a simulation model and report its responses |
| `demo_problem.py` | Run multiple replications of a given solution for an SO problem and report its objective function values and left-hand sides of stochastic constraints |
| File | Description |
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `demo_model.py` | Run multiple replications of a simulation model and report its responses |
| `demo_problem.py` | Run multiple replications of a given solution for an SO problem and report its objective function values and left-hand sides of stochastic constraints |
| `demo_problem_solver.py` | Run multiple macroreplications of a solver on a problem, save the outputs to a `.pickle` file in the `experiments/outputs` folder, and save plots of the results to `.png` files in the `experiments/plots` folder |
| `demo_problems_solvers.py` | Run multiple macroreplications of groups of problem-solver pairs and save the outputs and plots |
| `demo_data_farming_model.py` | Create a design over model factors, run multiple replications at each design point, and save the results to a comma separated value (`.csv`) file in the `data_farming_experiments` folder |
| `demo_san-sscont-ironorecont_experiment` | Run multiple solvers on multiple versions of (s, S) inventory, iron ore, and stochastic activiy network problems and produce plots |
| `demo_problems_solvers.py` | Run multiple macroreplications of groups of problem-solver pairs and save the outputs and plots |
| `demo_data_farming_model.py` | Create a design over model factors, run multiple replications at each design point, and save the results to a comma separated value (`.csv`) file in the `data_farming_experiments` folder |
| `demo_san-sscont-ironorecont_experiment` | Run multiple solvers on multiple versions of (s, S) inventory, iron ore, and stochastic activiy network problems and produce plots |

### Environment Setup

After downloading the source code, you will need to configure the conda environment to run the code. This can be done by running the following command in the terminal:

#### Windows (Command Prompt)
```cmd
setup_simopt.bat
```

#### Windows (PowerShell)
```powershell
cmd /c setup_simopt.bat
```

#### MacOS/Linux
```bash
chmod +x setup_simopt.sh && ./setup_simopt.sh
```

This script will create a new conda environment called `simopt` and install all necessary packages. To activate the environment, run the following command in the terminal:

```bash
conda activate simopt
```

If you wish to update the environment with the latest compatible packages, you can simply rerun the setup script.

## Graphical User Interface (GUI) - User Guide

Expand Down Expand Up @@ -208,18 +230,9 @@ The core development team currently consists of
- [**William Grochocinski**](https://github.com/Grochocinski) (North Carolina State University)

## Citation
To cite this work, please use
```
@misc{simoptgithub,
author = {D. J. Eckman and S. G. Henderson and S. Shashaani and R. Pasupathy},
title = {{SimOpt}},
year = {2024},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/simopt-admin/simopt}},
commit = {21802a685ec394fed048820e692209628f40dd4e}
}
```
To cite this work, please use the `CITATION.cff` file or use the built-in citation generator:
![GitHub's built-in citation generator](https://github.com/user-attachments/assets/b8b49544-eb74-469e-aa37-68c2c0c3708b)


## Acknowledgments
An earlier website for SimOpt ([http://www.simopt.org](http://www.simopt.org)) was developed through work supported by the following grants:
Expand Down
132 changes: 69 additions & 63 deletions demo/demo_data_farming_model.py
Original file line number Diff line number Diff line change
@@ -1,73 +1,79 @@
"""
"""Demo for Data Farming Models.

This script is intended to help with running a data-farming experiment on
a simulation model. It creates a design of model factors and runs multiple
replications at each configuration of the model. Outputs are printed to a file.
"""

import sys
import os.path as o

sys.path.append(
o.abspath(o.join(o.dirname(sys.modules[__name__].__file__), ".."))
) # type:ignore
from pathlib import Path

# Append the parent directory (simopt package) to the system path
sys.path.append(str(Path(__file__).resolve().parent.parent))

from simopt.data_farming_base import DataFarmingExperiment

# Specify the name of the model as it appears in directory.py
model_name = "CNTNEWS"

# Specify the names of the model factors (in order) that will be varied.
factor_headers = [
"purchase_price",
"sales_price",
"salvage_price",
"order_quantity",
]

# If creating the design, provide the name of a .txt file containing
# the following:
# - one row corresponding to each model factor being varied
# - three columns:
# - first column: lower bound for factor value
# - second column: upper bound for factor value
# - third column: (integer) number of digits for discretizing values
# (e.g., 0 corresponds to integral values for the factor)
# factor_settings_filename = "model_factor_settings"
factor_settings_filename = None

# OR, if the design has been created, provide the name of a .text file
# containing the following:
# - one row corresponding to each design point
# - the number of columns equal to the number of factors being varied
# - each value in the table gives the value of the factor (col index)
# for the design point (row index)
# E.g., design_filename = "model_factor_settings_design"
# design_filename = None
design_filename = "model_factor_settings_design"

# Specify a common number of replications to run of the model at each
# design point.
n_reps = 10

# Specify whether to use common random numbers across different versions
# of the model.
crn_across_design_pts = True

# Specify filename for outputs.
output_filename = "cntnews_data_farming_output"

# No code beyond this point needs to be edited.

# Create DataFarmingExperiment object.
myexperiment = DataFarmingExperiment(
model_name=model_name,
factor_settings_filename=factor_settings_filename,
factor_headers=factor_headers,
design_filepath=design_filename,
model_fixed_factors={},
)

# Run replications and print results to file.
myexperiment.run(n_reps=n_reps, crn_across_design_pts=crn_across_design_pts)
myexperiment.print_to_csv(csv_filename=output_filename)

def main() -> None:
"""Main function to run the data farming experiment."""
# Specify the name of the model as it appears in directory.py
model_name = "CNTNEWS"

# Specify the names of the model factors (in order) that will be varied.
factor_headers = [
"purchase_price",
"sales_price",
"salvage_price",
"order_quantity",
]

# If creating the design, provide the name of a .txt file containing
# the following:
# - one row corresponding to each model factor being varied
# - three columns:
# - first column: lower bound for factor value
# - second column: upper bound for factor value
# - third column: (integer) number of digits for discretizing values
# (e.g., 0 corresponds to integral values for the factor)
# factor_settings_filename = "model_factor_settings"
factor_settings_filename = None

# OR, if the design has been created, provide the name of a .text file
# containing the following:
# - one row corresponding to each design point
# - the number of columns equal to the number of factors being varied
# - each value in the table gives the value of the factor (col index)
# for the design point (row index)
# E.g., design_filename = "model_factor_settings_design"
# design_filename = None
design_filename = "model_factor_settings_design"

# Specify a common number of replications to run of the model at each
# design point.
n_reps = 10

# Specify whether to use common random numbers across different versions
# of the model.
crn_across_design_pts = True

# Specify filename for outputs.
output_filename = "cntnews_data_farming_output"

# No code beyond this point needs to be edited.

# Create DataFarmingExperiment object.
myexperiment = DataFarmingExperiment(
model_name=model_name,
factor_settings_file_name=factor_settings_filename,
factor_headers=factor_headers,
design_path=design_filename,
model_fixed_factors={},
)

# Run replications and print results to file.
myexperiment.run(n_reps=n_reps, crn_across_design_pts=crn_across_design_pts)
myexperiment.print_to_csv(csv_file_name=output_filename)


if __name__ == "__main__":
main()
Loading