diff --git a/notebooks/demo_fcsa.ipynb b/notebooks/demo_fcsa.ipynb index 26455cd4..e1643b2d 100644 --- a/notebooks/demo_fcsa.ipynb +++ b/notebooks/demo_fcsa.ipynb @@ -1,5 +1,26 @@ { "cells": [ + { + "cell_type": "markdown", + "id": "04c470f6", + "metadata": {}, + "source": [ + "# Demo for an experiment with FCSA on the SAN problem\n", + "This script is intented to demonstrate an experiment with three different versions of the FCSA solver on the SAN problem. " + ] + }, + { + "cell_type": "markdown", + "id": "8dffeae6", + "metadata": {}, + "source": [ + "## Append SimOpt Path\n", + "\n", + "Since the notebook is stored in simopt/notebooks, we need to append the\n", + "parent simopt directory to the system path to import the necessary modules\n", + "later on." + ] + }, { "cell_type": "code", "execution_count": null, @@ -32,6 +53,16 @@ "from simopt.solvers.fcsa import FCSA" ] }, + { + "cell_type": "markdown", + "id": "dc0e1dfe", + "metadata": {}, + "source": [ + "## Experiment Configuration Parameters\n", + "\n", + "Configure 3 versions of the solver: CSA, CSA-N, and FCSA and set problem configuration. Set report_all_solutions = True meaning all incumbent solutions will be reported. " + ] + }, { "cell_type": "code", "execution_count": null, @@ -117,6 +148,16 @@ "post_normalize(experiments, n_postreps)" ] }, + { + "cell_type": "markdown", + "id": "6d42598f", + "metadata": {}, + "source": [ + "## Plotting Settings\n", + "\n", + "Define the plotting settings for the experiments. Plot terminal objective progress, terminal feasibility progress, objective progress curve, and feasiblity progress curve for all incumbent solutions." + ] + }, { "cell_type": "code", "execution_count": null, @@ -185,6 +226,16 @@ ")" ] }, + { + "cell_type": "markdown", + "id": "418eefec", + "metadata": {}, + "source": [ + "## Experiment Configuration Parameters\n", + "\n", + "Configure 2 versions of the solver: CSA-N, and FCSA and set problem configuration. Set report_all_solutions = False meaning only recommended solutions will be reported. " + ] + }, { "cell_type": "code", "execution_count": null, @@ -226,6 +277,16 @@ "post_normalize([experiment2, experiment3], 100)" ] }, + { + "cell_type": "markdown", + "id": "5c9de038", + "metadata": {}, + "source": [ + "## Plotting Settings\n", + "\n", + "Define the plotting settings for the experiments. Plot terminal objective vs feasibility scatter plot for recommended solutions. " + ] + }, { "cell_type": "code", "execution_count": null, diff --git a/notebooks/demo_fcsa.py b/notebooks/demo_fcsa.py index 2a878ac2..0f7d29db 100644 --- a/notebooks/demo_fcsa.py +++ b/notebooks/demo_fcsa.py @@ -6,13 +6,24 @@ # extension: .py # format_name: percent # format_version: '1.3' -# jupytext_version: 1.17.3 +# jupytext_version: 1.18.1 # kernelspec: # display_name: Python 3 (ipykernel) # language: python # name: python3 # --- +# %% [markdown] +# # Demo for an experiment with FCSA on the SAN problem +# This script is intented to demonstrate an experiment with three different versions of the FCSA solver on the SAN problem. + +# %% [markdown] +# ## Append SimOpt Path +# +# Since the notebook is stored in simopt/notebooks, we need to append the +# parent simopt directory to the system path to import the necessary modules +# later on. + # %% import sys @@ -31,6 +42,11 @@ from simopt.models.san import SANLongestPathStochastic from simopt.solvers.fcsa import FCSA +# %% [markdown] +# ## Experiment Configuration Parameters +# +# Configure 3 versions of the solver: CSA, CSA-N, and FCSA and set problem configuration. Set report_all_solutions = True meaning all incumbent solutions will be reported. + # %% fixed_factors = { "constraint_nodes": [6, 8], # nodes with stochastic constraints @@ -88,6 +104,11 @@ def run_experiment(solver, problem, n_macroreps, n_postreps): experiment1, experiment2, experiment3 = experiments post_normalize(experiments, n_postreps) +# %% [markdown] +# ## Plotting Settings +# +# Define the plotting settings for the experiments. Plot terminal objective progress, terminal feasibility progress, objective progress curve, and feasiblity progress curve for all incumbent solutions. + # %% plot_terminal_progress([experiment1], PlotType.VIOLIN, normalize=False) @@ -114,6 +135,11 @@ def run_experiment(solver, problem, n_macroreps, n_postreps): print_max_hw=False, ) +# %% [markdown] +# ## Experiment Configuration Parameters +# +# Configure 2 versions of the solver: CSA-N, and FCSA and set problem configuration. Set report_all_solutions = False meaning only recommended solutions will be reported. + # %% csa_n = FCSA( fixed_factors={ @@ -141,5 +167,10 @@ def run_experiment(solver, problem, n_macroreps, n_postreps): experiment2, experiment3 = experiments post_normalize([experiment2, experiment3], 100) +# %% [markdown] +# ## Plotting Settings +# +# Define the plotting settings for the experiments. Plot terminal objective vs feasibility scatter plot for recommended solutions. + # %% plot_terminal_feasibility([[experiment2], [experiment3]], PlotType.FEASIBILITY_SCATTER)