Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,23 +94,24 @@ generator:
population_size: 64
population_file: test.csv
output_path: .
vocs:
variables:
x1: [0, 3.14159]
x2: [0, 3.14159]
objectives:
y1: MINIMIZE
y2: MINIMIZE
constraints:
c1: [GREATER_THAN, 0]
c2: [LESS_THAN, 0.5]
constants: {a: dummy_constant}

evaluator:
function: my_function
function_kwargs:
my_arguments: 42

vocs:
variables:
x1: [0, 3.14159]
x2: [0, 3.14159]
objectives:
y1: MINIMIZE
y2: MINIMIZE
constraints:
c1: [GREATER_THAN, 0]
c2: [LESS_THAN, 0.5]
constants: {a: dummy_constant}


stopping_condition:
name: MaxEvaluationsCondition
Expand Down Expand Up @@ -139,7 +140,7 @@ def sin_function(input_dict):
# create Xopt evaluator, generator, and Xopt objects
evaluator = Evaluator(function=sin_function)
generator = UpperConfidenceBoundGenerator(vocs=vocs)
X = Xopt(evaluator=evaluator, generator=generator, vocs=vocs)
X = Xopt(evaluator=evaluator, generator=generator)

# call X.random_evaluate() to generate + evaluate 3 initial points
X.random_evaluate(3)
Expand Down
19 changes: 9 additions & 10 deletions docs/examples/basic/checkpointing_and_restarts.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,21 @@
"dump_file: dump.yml\n",
"generator:\n",
" name: random\n",
" vocs:\n",
" variables:\n",
" x1: [0, 3.14159]\n",
" x2: [0, 3.14159]\n",
" objectives: {y1: MINIMIZE, y2: MINIMIZE}\n",
" constraints:\n",
" c1: [GREATER_THAN, 0]\n",
" c2: [LESS_THAN, 0.5]\n",
" constants: {a: dummy_constant}\n",
"\n",
"evaluator:\n",
" function: xopt.resources.test_functions.tnk.evaluate_TNK\n",
" function_kwargs:\n",
" a: 999\n",
"\n",
"vocs:\n",
" variables:\n",
" x1: [0, 3.14159]\n",
" x2: [0, 3.14159]\n",
" objectives: {y1: MINIMIZE, y2: MINIMIZE}\n",
" constraints:\n",
" c1: [GREATER_THAN, 0]\n",
" c2: [LESS_THAN, 0.5]\n",
" constants: {a: dummy_constant}\n",
"\n",
"\"\"\""
]
},
Expand Down
24 changes: 11 additions & 13 deletions docs/examples/basic/xopt_basic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@
},
"source": [
"## Xopt Components\n",
"The definition of the Xopt object requires 3 parts, listed below:\n",
"The definition of the Xopt object requires 2 parts, listed below:\n",
"- The `Evaluator` object, which evaluates input points using the arbitrary function\n",
"specified by the `function` property.\n",
"- The `Generator` object, which, when given data that has been evaluated, generates\n",
"future points to evaluate using the evaluator.\n",
"- The `VOCS` (variables, objectives, constraints, statics) object, which specifies the\n",
"input domain, the objectives, constraints and constants passed to the evaluator\n",
"function.\n"
" - The `VOCS` (variables, objectives, constraints, statics) object, which specifies the input domain, the objectives, constraints and constants passed to the evaluator\n",
" function.\n"
]
},
{
Expand Down Expand Up @@ -224,7 +223,7 @@
},
"outputs": [],
"source": [
"X = Xopt(vocs=vocs, generator=generator, evaluator=evaluator)"
"X = Xopt(generator=generator, evaluator=evaluator)"
]
},
{
Expand Down Expand Up @@ -259,14 +258,13 @@
"\n",
"generator:\n",
" name: random\n",
"\n",
"vocs:\n",
" variables:\n",
" x1: [0, 3.14159]\n",
" x2: [0, 3.14159]\n",
" objectives: {f: MINIMIZE}\n",
" constraints:\n",
" g: [LESS_THAN, 0]\n",
" vocs:\n",
" variables:\n",
" x1: [0, 3.14159]\n",
" x2: [0, 3.14159]\n",
" objectives: {f: MINIMIZE}\n",
" constraints:\n",
" g: [LESS_THAN, 0]\n",
"\n",
"\"\"\""
]
Expand Down
5 changes: 2 additions & 3 deletions docs/examples/basic/xopt_evaluator.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@
"outputs": [],
"source": [
"X = Xopt(\n",
" generator=RandomGenerator(vocs=vocs), evaluator=Evaluator(function=f), vocs=vocs\n",
" generator=RandomGenerator(vocs=vocs),\n",
" evaluator=Evaluator(function=f),\n",
")\n",
"X.strict = False\n",
"\n",
Expand Down Expand Up @@ -355,7 +356,6 @@
"X2 = AsynchronousXopt(\n",
" generator=RandomGenerator(vocs=vocs),\n",
" evaluator=Evaluator(function=f, executor=executor, max_workers=MAX_WORKERS),\n",
" vocs=vocs,\n",
")\n",
"X2.strict = False"
]
Expand Down Expand Up @@ -407,7 +407,6 @@
"X2 = AsynchronousXopt(\n",
" generator=RandomGenerator(vocs=vocs),\n",
" evaluator=Evaluator(function=f, executor=executor, max_workers=MAX_WORKERS),\n",
" vocs=vocs,\n",
")\n",
"X2.evaluator.vectorized = True\n",
"X2.strict = False\n",
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/basic/xopt_generator.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
"source": [
"evaluator = Evaluator(function=test_function)\n",
"generator = generator_type(vocs=vocs)\n",
"X = Xopt(generator=generator, evaluator=evaluator, vocs=vocs)\n",
"X = Xopt(generator=generator, evaluator=evaluator)\n",
"X"
]
},
Expand Down Expand Up @@ -177,7 +177,7 @@
"\n",
"\n",
"my_generator = MyGenerator(vocs=vocs)\n",
"X2 = Xopt(evaluator=evaluator, vocs=vocs, generator=my_generator)\n",
"X2 = Xopt(evaluator=evaluator, generator=my_generator)\n",
"\n",
"for i in range(4):\n",
" X2.step()"
Expand Down
23 changes: 12 additions & 11 deletions docs/examples/basic/xopt_parallel.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -98,22 +98,23 @@
" name: cnsga\n",
" output_path: temp\n",
" population_size: 64\n",
" \n",
" vocs:\n",
" variables:\n",
" x1: [0, 3.14159]\n",
" x2: [0, 3.14159]\n",
" objectives: {y1: MINIMIZE, y2: MINIMIZE}\n",
" constraints:\n",
" c1: [GREATER_THAN, 0]\n",
" c2: [LESS_THAN, 0.5]\n",
" constants: {a: dummy_constant}\n",
" \n",
"evaluator:\n",
" function: xopt.resources.test_functions.tnk.evaluate_TNK\n",
" function_kwargs:\n",
" sleep: 0\n",
" random_sleep: 0.1\n",
" \n",
"vocs:\n",
" variables:\n",
" x1: [0, 3.14159]\n",
" x2: [0, 3.14159]\n",
" objectives: {y1: MINIMIZE, y2: MINIMIZE}\n",
" constraints:\n",
" c1: [GREATER_THAN, 0]\n",
" c2: [LESS_THAN, 0.5]\n",
" constants: {a: dummy_constant}\n",
"\n",
"\n",
"\"\"\"\n",
"X = Xopt(YAML)\n",
Expand Down Expand Up @@ -575,7 +576,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
"version": "3.14.2"
}
},
"nbformat": 4,
Expand Down
8 changes: 0 additions & 8 deletions docs/examples/basic/xopt_stopping_condition.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@
"evaluator = Evaluator(function=sphere_function)\n",
"\n",
"X = Xopt(\n",
" vocs=sphere_vocs,\n",
" generator=generator,\n",
" evaluator=evaluator,\n",
" stopping_condition=max_evals_condition,\n",
Expand Down Expand Up @@ -212,7 +211,6 @@
"generator = UpperConfidenceBoundGenerator(vocs=sphere_vocs)\n",
"\n",
"X = Xopt(\n",
" vocs=sphere_vocs,\n",
" generator=generator,\n",
" evaluator=evaluator,\n",
" stopping_condition=target_condition,\n",
Expand Down Expand Up @@ -278,7 +276,6 @@
"generator = UpperConfidenceBoundGenerator(vocs=noisy_vocs)\n",
"\n",
"X = Xopt(\n",
" vocs=noisy_vocs,\n",
" generator=generator,\n",
" evaluator=noisy_evaluator,\n",
" stopping_condition=convergence_condition,\n",
Expand Down Expand Up @@ -352,7 +349,6 @@
"generator = UpperConfidenceBoundGenerator(vocs=sphere_vocs)\n",
"\n",
"X = Xopt(\n",
" vocs=sphere_vocs,\n",
" generator=generator,\n",
" evaluator=evaluator,\n",
" stopping_condition=stagnation_condition,\n",
Expand Down Expand Up @@ -453,7 +449,6 @@
"generator = RandomGenerator(vocs=constrained_vocs)\n",
"\n",
"X = Xopt(\n",
" vocs=constrained_vocs,\n",
" generator=generator,\n",
" evaluator=constrained_evaluator,\n",
" stopping_condition=feasibility_condition,\n",
Expand Down Expand Up @@ -551,7 +546,6 @@
"generator = UpperConfidenceBoundGenerator(vocs=sphere_vocs)\n",
"\n",
"X = Xopt(\n",
" vocs=sphere_vocs,\n",
" generator=generator,\n",
" evaluator=evaluator,\n",
" stopping_condition=composite_or_condition,\n",
Expand Down Expand Up @@ -603,7 +597,6 @@
"generator = UpperConfidenceBoundGenerator(vocs=sphere_vocs)\n",
"\n",
"X = Xopt(\n",
" vocs=sphere_vocs,\n",
" generator=generator,\n",
" evaluator=evaluator,\n",
" stopping_condition=composite_and_condition,\n",
Expand Down Expand Up @@ -724,7 +717,6 @@
"generator = UpperConfidenceBoundGenerator(vocs=sphere_vocs)\n",
"\n",
"X = Xopt(\n",
" vocs=sphere_vocs,\n",
" generator=generator,\n",
" evaluator=evaluator,\n",
" stopping_condition=configured_condition,\n",
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/bayes_exp/bayesian_exploration.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"\n",
"evaluator = Evaluator(function=evaluate_TNK)\n",
"\n",
"X = Xopt(generator=generator, evaluator=evaluator, vocs=vocs)\n",
"X = Xopt(generator=generator, evaluator=evaluator)\n",
"X"
]
},
Expand Down Expand Up @@ -253,7 +253,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
"version": "3.14.2"
}
},
"nbformat": 4,
Expand Down
24 changes: 12 additions & 12 deletions docs/examples/bayes_exp/bayesian_exploration_from_yaml.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@
"YAML = \"\"\"\n",
"generator:\n",
" name: bayesian_exploration\n",
"\n",
" vocs:\n",
" variables:\n",
" x1: [0, 3.14159]\n",
" x2: [0, 3.14159]\n",
" objectives:\n",
" y1: EXPLORE\n",
" constraints:\n",
" c1: [GREATER_THAN, 0]\n",
" c2: [LESS_THAN, 0.5]\n",
" constants: {a: dummy_constant}\n",
"evaluator:\n",
" function: xopt.resources.test_functions.tnk.evaluate_TNK\n",
"\n",
"vocs:\n",
" variables:\n",
" x1: [0, 3.14159]\n",
" x2: [0, 3.14159]\n",
" objectives:\n",
" y1: EXPLORE\n",
" constraints:\n",
" c1: [GREATER_THAN, 0]\n",
" c2: [LESS_THAN, 0.5]\n",
" constants: {a: dummy_constant}\n",
"\n",
"\n",
"\"\"\""
]
Expand Down Expand Up @@ -161,7 +161,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.10"
"version": "3.14.2"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"\n",
"evaluator = Evaluator(function=evaluate_TNK)\n",
"\n",
"X = Xopt(generator=generator, evaluator=evaluator, vocs=vocs)\n",
"X = Xopt(generator=generator, evaluator=evaluator)\n",
"X"
]
},
Expand Down Expand Up @@ -291,7 +291,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
"version": "3.14.2"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/bayes_exp/bayesian_exploration_with_nans.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"generator.numerical_optimizer.n_restarts = NUM_RESTARTS\n",
"\n",
"evaluator = Evaluator(function=evaluate)\n",
"X = Xopt(generator=generator, evaluator=evaluator, vocs=vocs)\n",
"X = Xopt(generator=generator, evaluator=evaluator)\n",
"X"
]
},
Expand Down Expand Up @@ -183,7 +183,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
"version": "3.14.2"
}
},
"nbformat": 4,
Expand Down
Loading