Skip to content

Commit a045274

Browse files
authored
Merge branch 'development' into feature_add_nbstripout
2 parents ef32fe6 + 17adf72 commit a045274

27 files changed

+5961
-6103
lines changed

.github/workflows/ty.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "ty CI"
2+
3+
on:
4+
push:
5+
branches: [ "master", "development" ]
6+
pull_request:
7+
branches: [ "master" , "development" ]
8+
9+
jobs:
10+
type_checker:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v5
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: "3.12"
20+
21+
- name: Install uv
22+
run: pip install uv
23+
24+
- name: Install Dependencies
25+
run: uv sync --all-extras
26+
27+
- name: ty Type Checking
28+
run: uv run ty check

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
cff-version: 1.2.0
55
title: SimOpt
6-
version: 1.2.0
6+
version: 1.2.1
77
message: >-
88
If you use this software, please cite it using the
99
metadata from this file

README.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
![SimOpt Logo](.github/resources/logo_full_magnifying_glass.png)
1+
![SimOpt Logo](https://raw.githubusercontent.com/simopt-admin/simopt/master/.github/resources/logo_full_magnifying_glass.png)
22

33
## About the Project
44
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.
@@ -36,7 +36,7 @@ Full documentation for the source code can be found on our **[readthedocs page](
3636
- It is ***highly recommended*** to check the box during installation to add Python/Miniconda/Anaconda to your system PATH.
3737
- 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](https://realpython.com/add-python-to-path/).
3838
- [VS Code](https://code.visualstudio.com/download) (optional)
39-
- This is a lightweight IDE that is compatible with Miniconda and is recommended for running the GUI
39+
- This is a lightweight IDE that is compatible with Miniconda.
4040
- [Git](https://git-scm.com/downloads) (optional)
4141
- If you don't have Git installed, you can download the code as a zip file instead
4242

@@ -49,7 +49,7 @@ There are two ways to download a copy of the source code onto your machine:
4949

5050
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.
5151

52-
The `demo` folder contains a handful of useful scripts that can be easily modified, as directed in the comments:
52+
The `notebooks` folder includes several useful Jupyter notebooks and scripts that are easy to customize. You can either run the scripts as standalone programs or open the notebooks in JupyterLab or VS Code. A description of the contents is provided below:
5353

5454
| File | Description |
5555
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
@@ -190,33 +190,37 @@ from simopt import models, solvers, experiment_base
190190
```
191191

192192
The following snippet of code will run 10 macroreplications of the Random Search solver ("RNDSRCH") on the Continuous Newsvendor problem ("CNTNEWS-1"):
193-
```
193+
```python
194194
myexperiment = simopt.experiment_base.ProblemSolver("RNDSRCH", "CNTNEWS-1")
195195
myexperiment.run(n_macroreps=10)
196196
```
197197

198198
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:
199-
```
199+
```python
200200
myexperiment.post_replicate(n_postreps=200)
201201
simopt.experiment_base.post_normalize([myexperiment], n_postreps_init_opt=200)
202202
```
203203

204204
A .txt file summarizing the progress of the solver on each macroreplication can be produced:
205-
```
205+
```python
206206
myexperiment.log_experiment_results()
207207
```
208208

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

211211
One can then plot the mean progress curve of the solver (with confidence intervals) with the objective function values shown on the y-axis:
212-
```
213-
simopt.experiment_base.plot_progress_curves(experiments=[myexperiment], plot_type="mean", normalize=False)
212+
```python
213+
simopt.experiment_base.plot_progress_curves(
214+
experiments=[myexperiment],
215+
plot_type=simopt.experiment_base.PlotType.MEAN,
216+
normalize=False,
217+
)
214218
```
215219

216-
The Python scripts in the `demo` folder provide more guidance on how to run common experiments using the library.
220+
The Python scripts in the `notebooks` folder provide more guidance on how to run common experiments using the library.
217221

218222
One can also use the SimOpt graphical user interface by running the following from the terminal:
219-
```
223+
```bash
220224
python -m simopt
221225
```
222226

@@ -230,6 +234,7 @@ The core development team currently consists of
230234
- [**Sara Shashaani**](https://shashaani.wordpress.ncsu.edu) (North Carolina State University)
231235
- [**Shane Henderson**](https://people.orie.cornell.edu/shane/) (Cornell University)
232236
- [**William Grochocinski**](https://github.com/Grochocinski) (North Carolina State University)
237+
- [**Cen Wang**](https://cenwangumass.github.io/) (Texas A&M University)
233238

234239
## Citation
235240
To cite this work, please use the `CITATION.cff` file or use the built-in citation generator:

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
project = "SimOpt"
2828
copyright = "2025, simopt-admin" # noqa: A001
2929
author = "simopt-admin"
30-
release = "1.2.0"
30+
release = "1.2.1"
3131

3232
# -- General configuration ---------------------------------------------------
3333

docs/source/models/dualsourcing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ Regular orders arrive after :math:`l_r` periods while expedited orders arrive af
1717
:math:`l_e < l_r`. Let the difference in lead times be :math:`l = l_r − l_e ≥ 1`.
1818

1919
If there is remaining on-hand inventory at the end of period :math:`n` (after demand :math:`d_n` is satisfied),
20-
these items are carried over to the next period (i.e., :math:`I_n+1 > 0`) at a holding cost per unit.
21-
However, if there is a stock-out (i.e., :math:`In + 1 < 0`), there is a penalty cost per unit
20+
these items are carried over to the next period (i.e., :math:`I_{n+1} > 0`) at a holding cost per unit.
21+
However, if there is a stock-out (i.e., :math:`I_{n+1} < 0`), there is a penalty cost per unit
2222
of unsatisfied demand.
2323

2424
We will let the period :math:`n` expediting order be based on the on-hand inventory plus the orders that

docs/source/models/san.rst

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -108,70 +108,79 @@ Optimal Objective Function Value
108108
Unknown
109109

110110
Optimization Problem: Minimize Longest Path Plus Penalty with Stochastic Constraints (SAN-2)
111-
============================================================================================
111+
--------------------------------------------------------------------------------------------
112112

113113
Decision Variables
114-
-------------------
114+
^^^^^^^^^^^^^^^^^^
115+
115116
* **arc_means**
116117

117118
Objectives
118-
-----------
119-
Suppose that we can select :math:`\theta_i > 0` for each :math:`i`, but there is an associated cost.
119+
^^^^^^^^^^
120+
121+
Suppose that we can select :math:`\theta_i > 0` for each :math:`i`, but there is an associated cost.
120122
In particular, we want to minimize:
121123

122124
.. math::
123125
124126
\mathbb{E}[T(\theta)] + f(\theta),
125127
126-
where :math:`T(\theta)` is the (random) duration of the longest path from node :math:`a` to node :math:`i`, and
128+
where :math:`T(\theta)` is the (random) duration of the longest path from node :math:`a` to node :math:`i`, and
127129

128130
.. math::
129131
130132
f(\theta) = \sum_{i=1}^{n} \theta_i^{-1},
131133
132134
where :math:`n` is the number of arcs.
133135

134-
The objective function is convex in :math:`\theta`.
136+
The objective function is convex in :math:`\theta`.
135137

136138
Constraints
137-
------------
138-
We require that :math:`\theta_i > 0` for each :math:`i`.
139+
^^^^^^^^^^^
140+
141+
We require that :math:`\theta_i > 0` for each :math:`i`.
139142
Additionally, we allow :math:`n` stochastic constraints that restrict the expected time to reach node :math:`i`, of the form:
140143

141144
.. math::
142145
143146
\mathbb{E}[T_i(\theta)] \leq a_i.
144147
145148
Problem Factors
146-
----------------
147-
* **budget**: Maximum number of replications the solver is allowed to take.
148-
*Default:* ``10000``
149+
^^^^^^^^^^^^^^^
149150

150-
* **arc_costs**: Cost associated with each arc.
151-
*Default:* ``(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)``
151+
* **budget**: Maximum number of replications the solver is allowed to take.
152+
*Default:* ``10000``
152153

153-
* **constraint_nodes**: Nodes with corresponding stochastic constraints.
154-
*Default:* ``[6, 8]``
154+
* **arc_costs**: Cost associated with each arc.
155+
*Default:* ``(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)``
155156

156-
* **length_to_node_constraint**: Maximum expected length to corresponding constraint nodes.
157-
*Default:* ``[5, 5]``
157+
* **constraint_nodes**: Nodes with corresponding stochastic constraints.
158+
*Default:* ``[6, 8]``
159+
160+
* **length_to_node_constraint**: Maximum expected length to corresponding constraint nodes.
161+
*Default:* ``[5, 5]``
158162

159163
Fixed Model Factors
160-
--------------------
164+
^^^^^^^^^^^^^^^^^^^
165+
161166
* **N/A**
162167

163168
Starting Solution
164-
------------------
169+
^^^^^^^^^^^^^^^^^
170+
165171
* **initial_solution**: ``(8,) * 13``
166172

167173
Random Solutions
168-
-----------------
174+
^^^^^^^^^^^^^^^^
175+
169176
Each arc mean is sampled independently from a lognormal distribution with 2.5th and 97.5th percentiles equal to 0.1 and 10, respectively.
170177

171178
Optimal Solution
172-
-----------------
179+
^^^^^^^^^^^^^^^^
180+
173181
* **Unknown**
174182

175183
Optimal Objective Function Value
176-
---------------------------------
184+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
185+
177186
* **Unknown**

pyproject.toml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,23 @@
22
requires = ["setuptools>=61.0"]
33
build-backend = "setuptools.build_meta"
44

5-
[tool.setuptools]
6-
packages = ["simopt", "simopt.gui", "simopt.models", "simopt.solvers"]
5+
[tool.setuptools.packages.find]
6+
where = ["."]
7+
include = ["simopt*"]
8+
# Ignore the build directory so we don't circularly include built distributions.
9+
exclude = ["build*"]
10+
11+
[tool.setuptools.package-data]
12+
"simopt.data_farming" = ["*.npz"]
713

814
[project]
915
name = "simoptlib"
10-
version = "1.2.0"
16+
version = "1.2.2.dev0"
1117
authors = [
1218
{ name = "David Eckman", email = "eckman@tamu.edu" },
1319
{ name = "Shane Henderson", email = "sgh9@cornell.edu" },
1420
{ name = "Sara Shashaani", email = "sshasha2@ncsu.edu" },
15-
{ name = "William Grochocinski", email = "wagrocho@ncsu.edu" },
21+
{ name = "William Grochocinski", email = "williamgrochocinski@gmail.com" },
1622
]
1723
description = "A testbed for simulation-optimization experiments."
1824
readme = "README.md"
@@ -38,9 +44,16 @@ dependencies = [
3844
]
3945

4046
[project.optional-dependencies]
41-
dev = ["ruff>=0.14.2", "jupytext", "nbstripout"]
47+
dev = [
48+
"nbstripout>=0.8.0",
49+
"jupytext>=1.18.1",
50+
"pytest-xdist>=3.8.0",
51+
"pytest>=9.0.1",
52+
"ruff>=0.14.2",
53+
"ty>=0.0.1a26",
54+
]
4255
docs = ["sphinx>=8.2.3", "sphinx-autoapi>=3.6.1", "sphinx-rtd-theme>=3.0.2"]
43-
notebooks = ["ipykernel"]
56+
notebooks = ["ipykernel>=7.1.0"]
4457

4558
[project.urls]
4659
"Homepage" = "https://github.com/simopt-admin/simopt"

0 commit comments

Comments
 (0)