simoptlib

A testbed of simulation-optimization problems and solvers

https://github.com/simopt-admin/simopt

Science Score: 77.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
    Links to: ieee.org, acm.org
  • Committers with academic emails
    6 of 18 committers (33.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.8%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

A testbed of simulation-optimization problems and solvers

Basic Info
  • Host: GitHub
  • Owner: simopt-admin
  • License: mit
  • Language: Python
  • Default Branch: master
  • Size: 349 MB
Statistics
  • Stars: 65
  • Watchers: 2
  • Forks: 29
  • Open Issues: 17
  • Releases: 5
Created over 6 years ago · Last pushed 6 months ago
Metadata Files
Readme License Citation

README.md

SimOpt Logo

About the Project

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). We are particularly interested in the finite-time performance of solvers, rather than the asymptotic results that one often finds in related literature.

For the purposes of this project, we define simulation as a very general technique for estimating statistical measures of complex systems. A system is modeled as if the probability distributions of the underlying random variables were known. Realizations of these random variables are then drawn randomly from these distributions. Each replication gives one observation of the system response, i.e., an evaluation of the objective function or stochastic constraints. By simulating a system in this fashion for multiple replications and aggregating the responses, one can compute statistics and use them for evaluation and design.

Several papers have discussed the development of SimOpt and experiments run on the testbed: * Eckman et al. (2024) studies feasibility metrics for stochastically constrained simulation-optimization problems in preparation for introducing related metrics in SimOpt. * Shashaani et al. (2024) conducts a large data-farming experiment over solver factors to learn relationships between their settings and a solver's finite-time performance. * Eckman et al. (2023) is the most up-to-date publication about SimOpt and describes the code architecture and how users can interact with the library. * Eckman et al. (2023) introduces the design of experiments for comparing solvers; this design has been implemented in the latest Python version of SimOpt. For detailed description of the terminology used in the library, e.g., factors, macroreplications, post-processing, solvability plots, etc., see this paper. * Eckman et al. (2019) describes in detail changes to the architecture of the MATLAB version of SimOpt and the control of random number streams. * Dong et al. (2017) conducts an experimental comparison of several solvers in SimOpt and analyzes their relative performance. * Pasupathy and Henderson (2011) describes an earlier interface for MATLAB implementations of problems and solvers. * Pasupathy and Henderson (2006) explains the original motivation for the testbed.

Code

Python

  • The master branch contains the source code for the latest stable release of the testbed
  • The development branch contains the latest code for the testbed, but may contain more bugs than the master branch

Matlab

⚠️ MATLAB versions of this testbed are no longer supported - The matlab branch contains a previous stable version of the testbed written in MATLAB

Documentation

Full documentation for the source code can be found on our readthedocs page.

Documentation Status

Getting Started

Requirements

  • Miniconda or Anaconda
    • 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.
    • It is highly recommended to check the box during installation to add Python/Miniconda/Anaconda to your system PATH.
    • If you know you have Python installed but are getting a Command not found error when trying to use Python commands, then you may need to add Python to your PATH.
  • VS Code (optional)
    • This is a lightweight IDE that is compatible with Miniconda and is recommended for running the GUI
  • Git (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

  1. Clone 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 and 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 | | 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 |

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

Main Menu

To open the GUI, run python -m simopt. This will launch the main menu. From the menu, you will be given 2 options: 1. Open the Data Farm Models window 2. Open the Simulation Optimization Experiments window (read more)

Simulation Optimization Experiments

Overview

From the GUI, you can create a specified problem-solver pair or a problem-solver group, run macroreplications, and generate plots. The main page provides ways to create or continue working with experiments:

  1. Create an individual problem-solver pair with customized problem and solver factors.
  2. Load a .pickle file of a previously created problem-solver pair.
  3. Create a problem-solver group.

At the bottom of the main page, there is a workspace containing all problem-solver pairs and problem-solver groups. The first tab lists the problem-solver pairs ready to be run or post-replicated, the second tab lists the problem-solver groups made from the cross-design or by generating a problem-solver group from partial set of problem-solver pair in the first tab, and the third tab lists those problem-solver pairs that are ready to be post-normalized and prepared for plotting.

1. Creating a problem-solver pair

This is the main way to add problem-solver pairs to the queue in the workspace. 1. First, select a solver from the "Solver" dropdown list. Each of the solvers has an abbreviation for the type of problems the solver can handle. Once a solver is selected, the "Problem" list will be sorted and show only the problems that work with the selected solver. 2. Change factors associated with the solver as necessary. The first factor is a customizable name for the solver that use can specify. 3. All solvers with unique combinations of factors must have unique names, i.e., no two solvers can have the same name, but different factors. If you want to use the same solver twice for a problem but with different solver factors, make sure you change the name of the solver accordingly. For example, if you want to create two problem-solver pairs with the same problem and solver but with or without CRN for the solver, you can change the name of the solver of choice for each pair to reflect that. This name will appear in the queue within the workspace below. 4. Select a problem from the "Problem" dropdown list. Each problem has an abbreviation indicating which types of solver is compatible to solve it. The letters in the abbreviation stand for:

| Objective | Constraint | Variable | Direct Gradient Observations | | ------------ | ----------------- | -------------- | ---------------------------- | | Single (S) | Unconstrained (U) | Discrete (D) | Available (G) | | Multiple (M) | Box (B) | Continuous (C) | Not Available (N) | | | Deterministic (D) | Mixed (M) | | | | Stochastic (S) | | |

  1. Change factors associated with the problem and model as necessary.
  2. All problems with unique factors must have unique names, i.e., no two problems can have the same name, but different factors. If you want to use the same problem twice for a solver but with different problem or model factors, make sure you change the name of the problem accordingly. This name will appear in the queue within the workspace below.
  3. The number of macroreplications can be modified in the top-left corner. The default is 10.
  4. Select the "Add problem-solver pair" button, which only appears when a solver and problem is selected. The problem-solver pair will be added in the "Queue of problem-solver pairs."

2. Loading a problem-solver pair from a file

Instead of creating a problem-solver pair from scratch, you can load one from a *.pickle file: 1. In the top left corner, click "Load a problem-solver pair". Your file system will pop up, and you can navigate to and select an appropriate *.pickle file. The GUI will throw an error if the selected file is not a *.pickle file. 2. Once a problem-solver pair object is loaded, it will be added to the "Queue of problem-solver pairs". 3. The Run and Post-Process buttons will be updated to accurately reflect whether the problem-solver pair has already been run and/or post-processed.

3. Creating a problem-solver group

Currently, problem-solver groups can only be created within the GUI or command line; they cannot be loaded from a file.

You can create a problem-solver group and add a new item to the "Queue of problem-solver groups" in two ways. The first is a quick grouping of problems and solvers that are compatible with their default factors: of problems and solvers with their default factors. 1. Click the "Create a problem-solver group" button. 2. Check the compatibility of the Problems and Solvers being selected. Note that solvers with deterministic constraint type can not handle problems with stochastic constraints (e.g., ASTRO-DF cannot be run on FACSIZE-2). 3. Specify the number of macroreplications - the default is 10. 4. Click "Confirm Cross-Design problem-solver group." 5. The pop-up window will disappear, and the problem-solver pairs frame will automatically switch to the "Queue of problem-solver groups". 6. To exit out of the problem-solver group pop-up without creating a problem-solver group, click the red "x" in the top-left corner of the window.

The second is converting a list of problem-solver pairs into a problem-solver group by a cross-design: 1. Select the problem-solver pairs of interest from the "Queue of problem-solver pairs". 2. Clicking the "Convert to a problem-solver group" button. This will complete the cross-design for the partial list and create a new row in the "Queue of problem-solver groups".

Running a problem-solver pair or a problem-solver group

To run a problem-solver pair or a problem-solver group, click the "Run" button in the "Queue of problem-solver pairs" or "Queue of problem-solver groups". Once the problem-solver pair or problem-solver group has been run, the "Run" button becomes disabled. Note: Running a problem-solver pair can take anywhere from a couple of seconds to a couple of minutes depending on the problem-solver pair and the number of macroreplications.

Post-Processing and Post-Normalization

Post-processing happens before post-normalizing and after the run is complete. You can specify the number of post-replications and the (proxy) optimal solution or function value. After post-normalization is complete, the Plotting window appears. To exit out of the Post-Process/Normalize pop-up without post-processing or post-normalizing, click the red "x" in the top-left corner of the window.

- problem-solver pair

problem-solver pairs can be post-processed from the "Queue of problem-solver pairs" tab by clicking "Post-Process." Adjust Post-Processing factors as necessary. Only problem-solver pairs that have already been run can be post-processed. After post-processing, click the "Post-Normalize by Problem" tab to select which problem-solver pairs to post-normalize together. * Only problem-solver pairs with the same problem can be post-normalized together. * Once all problem-solver pairs of interest are selected, click the "Post-Normalize Selected" button at the bottom of the GUI (this button only appears when in the Post-Normalize tab). * In the new pop-up form, update any values necessary and click "Post-Normalize" when the problem-solver pairs are ready to be post-normalized.

- problem-solver group

problem-solver groups are post-processed and post-normalized at the same time. In the "Queue of problem-solver groups" tab, click the "Post-Process" button for the specific problem-solver group, then change any values necessary, then click "Post-Process".

Plotting

The Plotting page is identical for both problem-solver pairs and problem-solver groups. Currently, multiple problem-solver pairs with the same problem can be plotted together, and any problem-solver pair from a single problem-solver group can be plotted together: 1. On the left side, select one or more problems from the problem list. 2. Select solvers from the solver list. 3. On the right side, select a plot type and adjust plot parameters and settings. There are 5 settings common to most plot types: Confidence Intervals, Number of Bootstrap Samples, Confidence Level, Plot Together, and Print Max HW. The type of plots that are currently available in the GUI are: Mean Progress Curve, Quantile Progress Curve, Solve Time CDF, Scatter Plot, CDF Solvability, Quantile Solvability, CDF Difference Plot, Quantile Difference Plot, Terminal Box/Violin, and Terminal Scatter. 4. Click "Add." 5. All plots will show in the plotting queue, along with information about their parameters and where the file is saved. 6. To view one plot, click "View Plot." All plots can be viewed together by clicking "See All Plots" at the bottom of the page. 7. To return to the main page, click the red "x" in the top-left corner of the window.

Package

The simoptlib package is available to download through the Python Packaging Index (PyPI) and can be installed from the terminal with the following command: python -m pip install simoptlib

Basic Example

After installing simoptlib, the package's main modules can be imported from the Python console (or in code): import simopt from simopt import models, solvers, experiment_base

The following snippet of code will run 10 macroreplications of the Random Search solver ("RNDSRCH") on the Continuous Newsvendor problem ("CNTNEWS-1"): myexperiment = simopt.experiment_base.ProblemSolver("RNDSRCH", "CNTNEWS-1") myexperiment.run(n_macroreps=10)

The results will be saved to a .pickle file in a folder called experiments/outputs. To post-process the results, by taking, for example 200 postreplications at each recommended solution, run the following: myexperiment.post_replicate(n_postreps=200) simopt.experiment_base.post_normalize([myexperiment], n_postreps_init_opt=200)

A .txt file summarizing the progress of the solver on each macroreplication can be produced: myexperiment.log_experiment_results()

A .txt file called RNDSRCH_on_CNTNEWS-1_experiment_results.txt will be saved in a folder called experiments/logs.

One can then plot the mean progress curve of the solver (with confidence intervals) with the objective function values shown on the y-axis: simopt.experiment_base.plot_progress_curves(experiments=[myexperiment], plot_type="mean", normalize=False)

The Python scripts in the demo folder provide more guidance on how to run common experiments using the library.

One can also use the SimOpt graphical user interface by running the following from the terminal: python -m simopt

Contributing

You can contribute problems and solvers to SimOpt (or fix other coding bugs) by forking the repository and initiating pull requests in GitHub to request that your changes be integrated.

Authors

The core development team currently consists of - David Eckman (Texas A&M University) - Sara Shashaani (North Carolina State University) - Shane Henderson (Cornell University) - William Grochocinski (North Carolina State University)

Citation

To cite this work, please use the CITATION.cff file or use the built-in citation generator: GitHub's built-in citation generator

Acknowledgments

An earlier website for SimOpt (http://www.simopt.org) was developed through work supported by the following grants: - National Science Foundation - DMI-0400287 - CMMI-0800688 - CMMI-1200315

Recent work on the development of SimOpt has been supported by the following grants - National Science Foundation - IIS-1247696 - CMMI-1254298 - CMMI-1536895 - CMMI-1537394 - DGE-1650441 - DMS-1839346 (TRIPODS+X) - CMMI-2206972 - OAC-2410948 - OAC-2410949 - OAC-2410950 - Air Force Office of Scientific Research - FA9550-12-1-0200 - FA9550-15-1-0038 - FA9550-16-1-0046 - Army Research Office - W911NF-17-1-0094

Any opinions, findings and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the National Science Foundation (NSF).

Owner

  • Login: simopt-admin
  • Kind: user

Citation (CITATION.cff)

# 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

GitHub Events

Total
  • Create event: 56
  • Release event: 1
  • Issues event: 61
  • Watch event: 13
  • Delete event: 56
  • Member event: 3
  • Issue comment event: 43
  • Push event: 422
  • Pull request review comment event: 1
  • Pull request review event: 6
  • Pull request event: 110
  • Fork event: 5
Last Year
  • Create event: 56
  • Release event: 1
  • Issues event: 61
  • Watch event: 13
  • Delete event: 56
  • Member event: 3
  • Issue comment event: 43
  • Push event: 422
  • Pull request review comment event: 1
  • Pull request review event: 6
  • Pull request event: 110
  • Fork event: 5

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 687
  • Total Committers: 18
  • Avg Commits per committer: 38.167
  • Development Distribution Score (DDS): 0.392
Top Committers
Name Email Commits
simopt-admin s****b@g****m 418
sshashaa s****2@n****u 86
sshashaa s****i@g****m 56
Nicole Colberg n****r@n****u 43
formatt18 m****2@c****u 23
Yunsoo-Ha 6****a@u****m 13
zhhorton z****n@n****u 10
Nicole Colberg 7****g@u****m 9
Rina Davila 9****a@u****m 8
fordmatt18 7****8@u****m 7
kekonrad 6****d@u****m 5
simopt-admin 5****n@u****m 2
pjain159 8****9@u****m 2
Joe Ye t****7@c****u 1
soorajpn123 s****3@u****m 1
mstrmnd1 d****g@g****m 1
Sean Reed s****n@s****m 1
Shane Henderson s****9@c****u 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 50
  • Total pull requests: 127
  • Average time to close issues: 26 days
  • Average time to close pull requests: 9 days
  • Total issue authors: 6
  • Total pull request authors: 17
  • Average comments per issue: 0.8
  • Average comments per pull request: 0.26
  • Merged pull requests: 106
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 46
  • Pull requests: 75
  • Average time to close issues: 27 days
  • Average time to close pull requests: about 17 hours
  • Issue authors: 3
  • Pull request authors: 3
  • Average comments per issue: 0.67
  • Average comments per pull request: 0.25
  • Merged pull requests: 69
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • Grochocinski (47)
  • ThomasPWCope (1)
  • weslleyspereira (1)
  • timmens (1)
  • milzj (1)
  • Mark-L-Stone (1)
Pull Request Authors
  • Grochocinski (135)
  • sshashaa (11)
  • fordmatt18 (8)
  • JennaCuniowski (6)
  • nicolberg (3)
  • Joeyetinghan (3)
  • nlondono97 (2)
  • LilibethE (2)
  • liulitong-Jessie (2)
  • natthab (2)
  • Yunsoo-Ha (1)
  • mstrmnd1 (1)
  • KevinYihangXu (1)
  • sean-reed (1)
  • zhhorton (1)
Top Labels
Issue Labels
bug (28) enhancement (17) question (1) documentation (1) good first issue (1)
Pull Request Labels
enhancement (4)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 48 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 5
  • Total maintainers: 1
pypi.org: simoptlib

A testbed for simulation-optimization experiments.

  • Homepage: https://github.com/simopt-admin/simopt
  • Documentation: https://simopt.readthedocs.io/en/latest/
  • License: 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.
  • Latest release: 1.1.1
    published about 1 year ago
  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 48 Last month
Rankings
Forks count: 8.5%
Stargazers count: 9.5%
Dependent packages count: 10.1%
Average: 15.3%
Dependent repos count: 21.6%
Downloads: 26.8%
Maintainers (1)
Last synced: 6 months ago

Dependencies

simoptlib.egg-info/requires.txt pypi
  • matplotlib >=3.2.2
  • mrg32k3a >=1.0.0
  • numpy >=1.21.6
  • pandas >=1.3.5
  • scipy >=1.7.3
  • seaborn >=0.11.2