|
78 | 78 | "metadata": {}, |
79 | 79 | "outputs": [], |
80 | 80 | "source": [ |
81 | | - "# Classes for Problem and Solver info\n", |
82 | | - "# These don't need modified, they're just used to organize the problem and solver info.\n", |
83 | | - "class Problem:\n", |
84 | | - " \"\"\"Problem class to hold problem information.\"\"\"\n", |
| 81 | + "# Classes for Problem and Solver config info\n", |
| 82 | + "# These don't need modified\n", |
| 83 | + "class ProblemConfig:\n", |
| 84 | + " \"\"\"Class to hold problem config information.\"\"\"\n", |
85 | 85 | "\n", |
86 | 86 | " def __init__(\n", |
87 | 87 | " self,\n", |
|
97 | 97 | " self.model_fixed_factors = model_fixed_factors if model_fixed_factors else {}\n", |
98 | 98 | "\n", |
99 | 99 | "\n", |
100 | | - "class Solver:\n", |
101 | | - " \"\"\"Solver class to hold solver information.\"\"\"\n", |
| 100 | + "class SolverConfig:\n", |
| 101 | + " \"\"\"Class to hold solver config information.\"\"\"\n", |
102 | 102 | "\n", |
103 | 103 | " def __init__(\n", |
104 | 104 | " self, name: str, rename: str | None = None, fixed_factors: dict | None = None\n", |
|
119 | 119 | "from simopt.experiment_base import ProblemSolver, post_normalize\n", |
120 | 120 | "\n", |
121 | 121 | "\n", |
122 | | - "# Function to run an experiment with the given problems and solvers.\n", |
| 122 | + "# Function to run an experiment with the given problem and solver configs.\n", |
123 | 123 | "def run_experiment(\n", |
124 | | - " problems: list[Problem],\n", |
125 | | - " solvers: list[Solver],\n", |
| 124 | + " problems: list[ProblemConfig],\n", |
| 125 | + " solvers: list[SolverConfig],\n", |
126 | 126 | ") -> list[list[ProblemSolver]]:\n", |
127 | | - " \"\"\"Run the Experiment for the given problems and solvers.\n", |
| 127 | + " \"\"\"Run an experiment using the provided configurations.\n", |
128 | 128 | "\n", |
129 | 129 | " Args:\n", |
130 | | - " problems: List of Problem instances.\n", |
131 | | - " solvers: List of Solver instances.\n", |
| 130 | + " problems: List of ProblemConfig instances.\n", |
| 131 | + " solvers: List of SolverConfig instances.\n", |
132 | 132 | "\n", |
133 | 133 | " Returns:\n", |
134 | 134 | " List[list[ProblemSolver]]: A list of lists containing ProblemSolver instances,\n", |
|
192 | 192 | "# Includes two versions of random search with varying sample sizes.\n", |
193 | 193 | "# The rename will be used in the plots to differentiate them.\n", |
194 | 194 | "solvers = [\n", |
195 | | - " Solver(name=\"RNDSRCH\", rename=\"RNDSRCH_ss=10\", fixed_factors={\"sample_size\": 10}),\n", |
196 | | - " Solver(name=\"RNDSRCH\", rename=\"RNDSRCH_ss=50\", fixed_factors={\"sample_size\": 50}),\n", |
197 | | - " Solver(name=\"ASTRODF\"),\n", |
198 | | - " Solver(name=\"NELDMD\"),\n", |
199 | | - " Solver(name=\"STRONG\"),\n", |
| 195 | + " SolverConfig(\n", |
| 196 | + " name=\"RNDSRCH\", rename=\"RNDSRCH_ss=10\", fixed_factors={\"sample_size\": 10}\n", |
| 197 | + " ),\n", |
| 198 | + " SolverConfig(\n", |
| 199 | + " name=\"RNDSRCH\", rename=\"RNDSRCH_ss=50\", fixed_factors={\"sample_size\": 50}\n", |
| 200 | + " ),\n", |
| 201 | + " SolverConfig(name=\"ASTRODF\"),\n", |
| 202 | + " SolverConfig(name=\"NELDMD\"),\n", |
| 203 | + " SolverConfig(name=\"STRONG\"),\n", |
200 | 204 | "]" |
201 | 205 | ] |
202 | 206 | }, |
|
235 | 239 | "\n", |
236 | 240 | "# Create all the problem variants.\n", |
237 | 241 | "SAN_problems = [\n", |
238 | | - " Problem(\n", |
| 242 | + " ProblemConfig(\n", |
239 | 243 | " name=\"SAN-1\",\n", |
240 | 244 | " rename=f\"SAN-1_rc={costs}\",\n", |
241 | 245 | " fixed_factors={\n", |
|
267 | 271 | "\n", |
268 | 272 | "# Create all the problem variants.\n", |
269 | 273 | "SSCONT_problems = [\n", |
270 | | - " Problem(\n", |
| 274 | + " ProblemConfig(\n", |
271 | 275 | " name=\"SSCONT-1\",\n", |
272 | 276 | " rename=f\"SSCONT-1_dm={dm}_lm={lm}\",\n", |
273 | 277 | " fixed_factors={\"budget\": 1000},\n", |
|
302 | 306 | "\n", |
303 | 307 | "# Create all the problem variants.\n", |
304 | 308 | "IRONORECONT_problems = [\n", |
305 | | - " Problem(\n", |
| 309 | + " ProblemConfig(\n", |
306 | 310 | " name=\"IRONORECONT-1\",\n", |
307 | 311 | " rename=f\"IRONORECONT-1_sd={sd}_hc={hc}_inv={inv}\",\n", |
308 | 312 | " fixed_factors={\"budget\": 1000},\n", |
|
574 | 578 | "name": "python", |
575 | 579 | "nbconvert_exporter": "python", |
576 | 580 | "pygments_lexer": "ipython3", |
577 | | - "version": "3.13.3" |
| 581 | + "version": "3.13.5" |
578 | 582 | } |
579 | 583 | }, |
580 | 584 | "nbformat": 4, |
|
0 commit comments