-
Notifications
You must be signed in to change notification settings - Fork 579
[Pyomo.DoE] Add simultaneous design of multiple experiments #3866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 185 commits
ed6707a
eed6329
4861662
bf5eb91
f70e461
7c7332b
f5ba35e
79d09cc
fc0f8a5
1a80a6c
948e77c
b83ce4f
63488f0
6a53dc9
4fa587c
422f0c2
4bb38dc
974598b
c38875b
62f28ed
42b8744
26ea0a6
cb19d00
e56276a
0f7cc9e
03bfb89
e9d33b7
0833295
ca0a4dd
02aa81a
d1493a5
802438b
5ae8280
476bc09
fe6ef62
3879b1c
73d9387
2f1f5a1
7913222
65cc0cc
72dd1eb
ce032b5
845de61
05097d5
c386945
859e214
6f401ad
ce305a6
72df8e1
dd86620
bcc833a
82a8aad
336ea3a
2fda230
da15eef
d5a2411
bb65dcf
40381f7
786d8dd
5947553
2919813
f37bc1d
3338e8b
0b2e546
490f8fe
a9287e2
afa7090
e1db056
6a429d2
995f137
dbfc6ba
a62a67b
e17a896
489be46
33b5e66
25752c0
5657dab
60c4a96
e09d340
b7111a3
3df6c9a
0bfc396
4e3b72d
290747e
c76632f
4041693
6be8b2f
d6ee86b
77f6ff7
f542882
74eb4bc
eabc592
fe72c91
edaae02
0d236c4
adf7de2
b4a50e3
faa689c
eef390a
280b01a
c6be263
592d54c
1f8f016
ff5e465
967e790
8ee7b2b
3c034b7
c4103d9
1518abe
e4fbf66
ee6e63f
ebc7aa3
8f4732d
735762c
584091c
3a52f2d
3678ecb
990b812
0266ca3
c1ca9c6
1e1c048
bc08c2a
35ee2f9
3e66a71
293f9c6
b145e3c
f03a862
ecdde5a
4bb0a5a
967d0fa
a2d42dc
f6ea71f
d927ed9
2b28bcb
0f653a8
c85e4fb
5c856e2
8a95a60
c83ea69
0089ff1
211f16c
7d9d2c5
eceee44
652ee57
8dfee15
04f7b3e
6ed6c90
aeb3916
250aa64
5516fbf
ba82571
d3ce44d
7a3db4b
6db76ff
bebda40
199d7db
5de90ce
fab71e1
762c128
21f79dd
68e9cce
b4fb2a1
e0d17f1
3960614
f604ceb
683e797
73b7744
c76c461
82bf682
0d17088
cbdbb07
7167a5c
3512967
1f763f2
d192e9a
b4505ef
651621a
e6d7a27
20b2991
867a84b
c444b69
ceae3d7
6b3e5bf
bd6d099
8edc6fa
dc1bfc4
0980905
a20061b
8346a48
e0a9d5f
fd51a4c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,3 +70,80 @@ def get_labeled_model(self): | |
| m.bad_con_2 = pyo.Constraint(expr=m.hour <= 0.0) | ||
|
|
||
| return m | ||
|
|
||
|
|
||
| class RooneyBieglerMultiExperiment(RooneyBieglerExperiment): | ||
| """ | ||
| Experiment class based on the multi-experiment Rooney-Biegler prototype. | ||
|
|
||
| This mirrors the implementation in | ||
| ``examples/multiexperiment-prototype/rooney_biegler_multiexperiment.py`` | ||
| while allowing test-time control over initial hour and bounds. | ||
| """ | ||
|
|
||
| def __init__( | ||
| self, hour=2.0, y=10.0, theta=None, measure_error=0.1, hour_bounds=(1.0, 10.0) | ||
| ): | ||
| data = {'hour': hour, 'y': y} | ||
| super().__init__(data=data, measure_error=measure_error, theta=theta) | ||
| self.hour_bounds = hour_bounds | ||
|
|
||
| def get_labeled_model(self): | ||
| m = super().get_labeled_model() | ||
| hour_lb, hour_ub = self.hour_bounds | ||
| m.hour.setlb(hour_lb) | ||
| m.hour.setub(hour_ub) | ||
|
|
||
| if hasattr(m, "sym_break_cons"): | ||
| m.sym_break_cons.clear() | ||
| else: | ||
| m.sym_break_cons = pyo.Suffix(direction=pyo.Suffix.LOCAL) | ||
| m.sym_break_cons[m.hour] = None | ||
|
Comment on lines
+97
to
+101
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this needed? Are you adding a new required
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes — in multi-experiment design, We do this to reduce permutation symmetry and save solver time. In multi-experiment design, the order of experiments does not matter. For example, if we are designing two experiments with design variable T, then the designs ( |
||
| return m | ||
|
|
||
|
|
||
| class RooneyBieglerMultiInputExperimentFlag(RooneyBieglerExperiment): | ||
| """ | ||
| Two-input Rooney-Biegler style experiment for symmetry-breaking tests. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| sym_break_flag : int | ||
| 0 -> do not add ``sym_break_cons`` suffix | ||
| 1 -> add single marker (hour) | ||
| 2 -> add multiple markers (hour and temp) | ||
| """ | ||
|
|
||
| def __init__(self, hour=2.0, temp=300.0, y=10.0, sym_break_flag=1): | ||
| data = {'hour': hour, 'y': y} | ||
| super().__init__( | ||
| data=data, measure_error=0.1, theta={'asymptote': 15, 'rate_constant': 0.5} | ||
| ) | ||
| self.hour = hour | ||
| self.temp = temp | ||
| self.sym_break_flag = sym_break_flag | ||
|
|
||
| def get_labeled_model(self): | ||
| m = super().get_labeled_model() | ||
|
|
||
| m.hour.setlb(1.0) | ||
| m.hour.setub(10.0) | ||
| m.temp = pyo.Var(initialize=self.temp, bounds=(280.0, 340.0)) | ||
| m.temp.fix() | ||
|
|
||
| # Replace base Rooney-Biegler response with two-input synthetic variant | ||
| # used only for symmetry-breaking tests. | ||
| m.del_component(m.response_function) | ||
| m.response_function = pyo.Constraint( | ||
| expr=m.y | ||
| == m.asymptote * (1 - pyo.exp(-m.rate_constant * m.hour)) + 0.01 * m.temp | ||
| ) | ||
| m.experiment_inputs[m.temp] = self.temp | ||
|
Comment on lines
+131
to
+141
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is only used for symmetry-breaking tests, should this code be moved inside the if-statement below that is checking if the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We keep that code outside the We still need the temp input and modified response when |
||
|
|
||
| if self.sym_break_flag in (1, 2): | ||
| m.sym_break_cons = pyo.Suffix(direction=pyo.Suffix.LOCAL) | ||
| m.sym_break_cons[m.hour] = None | ||
| if self.sym_break_flag == 2: | ||
| m.sym_break_cons[m.temp] = None | ||
|
|
||
| return m | ||
Uh oh!
There was an error while loading. Please reload this page.