Skip to content

Commit

Permalink
Implement categorical decreed variables (#474)
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-Saves authored Nov 15, 2023
1 parent 3a5b108 commit 8e1b7ea
Show file tree
Hide file tree
Showing 10 changed files with 1,357 additions and 203 deletions.
39 changes: 34 additions & 5 deletions doc/_src_docs/applications/Mixed_Hier_usage.rst

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions doc/_src_docs/applications/Mixed_Hier_usage.rstx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ The design space definition uses the framework of Audet et al. [2]_ to manage bo
hierarchical variables. We distinguish dimensional (or meta) variables which are a special type of variables that may
affect the dimension of the problem and decide if some other decreed variables are acting or non-acting.

Additionally, it is also possible to define value constraints that explicitly forbid two variables from having some
values simultaneously. This can be useful for modeling incompatibility relationships: for example, engines can't be
installed on the back of the fuselage (vs on the wings) if a normal tail (vs T-tail) is selected. Note: this feature
is only available if ConfigSpace has been installed: `pip install smt[cs]`

The hierarchy relationships are specified after instantiating the design space:


Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ numba # JIT compiler
matplotlib # used in examples and tests
pytest # tests runner
pytest-xdist # allows running parallel testing with pytest -n <num_workers>
black # check code format
black # check code format
ConfigSpace~=0.6.1
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@
"numba": [ # pip install smt[numba]
"numba~=0.56.4",
],
"cs": [ # pip install smt[cs]
"ConfigSpace~=0.6.1",
],
},
python_requires=">=3.7",
zip_safe=False,
Expand Down
4 changes: 2 additions & 2 deletions smt/applications/tests/test_ego.py
Original file line number Diff line number Diff line change
Expand Up @@ -997,8 +997,8 @@ def f_obj(X):
n_start=15,
)
x_opt, y_opt, dnk, x_data, y_data = ego.optimize(fun=f_obj)
self.assertAlmostEqual(np.sum(y_data), 2.03831406306514, delta=1e-4)
self.assertAlmostEqual(np.sum(x_data), 33.56885202767958, delta=1e-4)
self.assertAlmostEqual(np.sum(y_data), 2.7639515433083854, delta=1e-4)
self.assertAlmostEqual(np.sum(x_data), 32.11001423996299, delta=1e-4)

def test_ego_gek(self):
ego, fun = self.initialize_ego_gek()
Expand Down
Loading

0 comments on commit 8e1b7ea

Please sign in to comment.