Skip to content
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

Pyomo TCLab v6: optimization proof of concept #3

Open
wants to merge 94 commits into
base: tclab-notebook-v5
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
d436d29
Merge pull request #2 from jakekrell/tclab_v4
adowling2 Jun 27, 2024
77ead3f
Created new file
adowling2 Jun 27, 2024
76fb993
Numeric integration error
adowling2 Jun 27, 2024
ae00701
No lag model is not working well
adowling2 Jun 27, 2024
4aedd88
Attempted step test. Not successful.
adowling2 Jun 27, 2024
4ae19ae
Updated descriptive text at top of notebooks
adowling2 Jun 27, 2024
ee9d316
Renamed file.
adowling2 Jun 27, 2024
19a6b4c
Merge pull request #24 from adowling2/pyomo-tlab2
jakekrell Jun 27, 2024
95487bf
v5c complete
jakekrell Jun 27, 2024
9d11c4a
Merge pull request #4 from jakekrell/tclab_v4
adowling2 Jun 28, 2024
034cf0a
Added skeleton for optimization with Pyomo
adowling2 Jun 28, 2024
4bd4ddb
Minor update
adowling2 Jun 28, 2024
ee3252e
Fixed a syntax mistake
adowling2 Jun 28, 2024
7722b2a
Merge pull request #25 from adowling2/pyomo-tlab2
jakekrell Jun 28, 2024
1f7ebf7
v5c patch
jakekrell Jun 28, 2024
ea3a0b8
v5d complete
jakekrell Jun 28, 2024
87581eb
v6_optimal1_notes and v5d patch
jakekrell Jun 28, 2024
401e3ad
v5c patch and v5c2 complete
jakekrell Jul 1, 2024
3c710f6
v5c patch
jakekrell Jul 1, 2024
6495c58
init v6_optimize1_with_v5c2
jakekrell Jul 2, 2024
6ba59d5
continued test dev of fokl_to_pyomo ODE
jakekrell Jul 3, 2024
80fe573
v6_optimize1_with_v5c2 successful up to ipopt
jakekrell Jul 8, 2024
0bdf504
patch
jakekrell Jul 8, 2024
f82f510
IPOPT - Converged to a locally infeasible
jakekrell Jul 8, 2024
7894d45
IPOPT - Converged to a locally infeasible
jakekrell Jul 8, 2024
61de608
patch
jakekrell Jul 8, 2024
257e9ec
_old folder added for pre-v7
jakekrell Jul 8, 2024
a8fc638
patch
jakekrell Jul 8, 2024
2ebfb4c
notebook updated to reflect py
jakekrell Jul 11, 2024
19e3b96
patch
jakekrell Jul 11, 2024
88966e6
tclab dae.Simulator working with m.du1_dummy and RHS initizalization
jakekrell Jul 12, 2024
4ffe6c7
v7 ipopt sol did not improve with various attempts suggesting sol rea…
jakekrell Jul 12, 2024
6fe56d0
v7 ipopt sol did not improve with various attempts suggesting sol rea…
jakekrell Jul 12, 2024
16ec50d
v7 complete
jakekrell Jul 12, 2024
00affc1
v7 - GP comparison
jakekrell Jul 12, 2024
cbb677e
v8 and v9 - beginning of demo step tests as training
jakekrell Jul 16, 2024
9067f4e
v8 and v9 - beginning of demo step tests as training
jakekrell Jul 16, 2024
15938b1
CHECKPOINT - v9 attempt complete with figs; successful demonstration …
jakekrell Jul 16, 2024
82f3a3d
v10 near complete - GP validated in sine test and nails reference r
jakekrell Jul 16, 2024
9eb350f
checkpoint before pyomo scenarios
jakekrell Jul 18, 2024
caaff1c
broken code - i.e. pseudo code for new fokl_to_pyomo with scenarios i…
jakekrell Jul 18, 2024
eb5611f
prior to deleting development notes / comments
jakekrell Jul 21, 2024
578fd5a
fokl_to_pyomo dev of t s indices complete up to basis funcs
jakekrell Jul 22, 2024
5d755e7
func complete but not tested debugged
jakekrell Jul 22, 2024
614580a
new fokl_to_pyomo with auto scenarios index complete - not yet tested…
jakekrell Jul 22, 2024
681b263
v11b in progress
jakekrell Jul 22, 2024
6474d0b
Added sequence of step tests file
adowling2 Jul 23, 2024
32bc199
prior to making y_avg avg across draws for support of xvar indexed by…
jakekrell Jul 23, 2024
98ba40d
patch
jakekrell Jul 23, 2024
4a46a8e
Merge pull request #29 from adowling2/sequence-step-tests
jakekrell Jul 23, 2024
1f9f635
v11 up to new fokl_to_pyomo successful debug test
jakekrell Jul 24, 2024
e67140a
Began exploring derivative of residuals
adowling2 Jul 24, 2024
701653c
Merge pull request #30 from adowling2/sequence-step-tests
jakekrell Jul 24, 2024
86739de
failed attempt to validate updated fokl_to_pyomo
jakekrell Jul 24, 2024
c313932
Merge branch 'tclab' of https://github.com/jakekrell/FoKL-GPy into tclab
jakekrell Jul 24, 2024
5dffcbb
CHECKPOINT v12.ipynb last fig marks most accurate u optimization usin…
jakekrell Jul 24, 2024
8dd3176
v13 attempt to model dResid with GP - predictions worse
jakekrell Jul 25, 2024
ca3f44d
v13 pyomo with GP solved successfully but results worse
jakekrell Jul 26, 2024
8415947
v13.1 is v13.0 with excess code removed
jakekrell Jul 26, 2024
44bf636
v13 alt attempt1 S_GP H improved benchmark - not sure exactly why
jakekrell Jul 26, 2024
c3475bc
patch
jakekrell Jul 26, 2024
a31e3e9
v13.1 modified with tips from alex for next version
jakekrell Jul 26, 2024
52f0887
files moved and v13.2 started as more formal notebook testing differe…
jakekrell Jul 26, 2024
ad92a9b
comparison of benchmark, black box, R, and dR
jakekrell Jul 29, 2024
4f475dd
various FoKL models attempting to improve v13.3 GP
jakekrell Jul 30, 2024
0676ef3
GP with Th1, Ts1, u1 inputs decent RMSE and fast training
jakekrell Jul 30, 2024
25efd70
CSV of Pyomo solution - to be tested on TCLab HW
jakekrell Jul 30, 2024
a542871
Merge pull request #5 from jakekrell/tclab
adowling2 Jul 31, 2024
fb975cd
Added results from validation experiment
adowling2 Jul 31, 2024
f854810
Added another validation experiment
adowling2 Jul 31, 2024
471133c
Merge pull request #31 from adowling2/pyomo-tlab2
jakekrell Aug 1, 2024
68f9e57
NEW CSVs OF Q1 PYOMO SOLUTION - average of draws succeeded but fokl_t…
jakekrell Aug 2, 2024
3cd9628
Delete examples/pyomo_tclab/data/solution_benchmark.csv
jakekrell Aug 2, 2024
8c57cf0
Merge pull request #6 from jakekrell/tclab
adowling2 Aug 2, 2024
37c4962
Added validation experiment 3 results
adowling2 Aug 2, 2024
ae820fe
Added validation experiment 4
adowling2 Aug 2, 2024
262b046
finalizing tclab - new u1 solutions saved pending experimental result…
jakekrell Aug 8, 2024
39a680d
Merge branch 'tclab' of https://github.com/jakekrell/FoKL-GPy into tclab
jakekrell Aug 8, 2024
5162a98
Merge pull request #7 from jakekrell/tclab
adowling2 Aug 8, 2024
52bfd28
Validate Experiment 5
adowling2 Aug 8, 2024
720c0be
Validation Experiment 6
adowling2 Aug 8, 2024
8286609
Merge pull request #32 from adowling2/pyomo-tlab2
jakekrell Aug 8, 2024
034980f
setpoint experimental results appended to GP training data for new u …
jakekrell Aug 8, 2024
ad8730b
dae.collocation moved to before fokl_to_pyomo to fix bug
jakekrell Aug 8, 2024
f5f7761
Merge pull request #8 from jakekrell/tclab
adowling2 Aug 9, 2024
34e3bd6
Added validation experiment 6b
adowling2 Aug 9, 2024
a607f34
Added validation experiment 7
adowling2 Aug 9, 2024
0cac1f4
Merge pull request #33 from adowling2/pyomo-tlab2
jakekrell Aug 12, 2024
146146e
checkpoint with some new updates prior to meeting w alex
jakekrell Aug 12, 2024
a903256
Added another test with multiple steps.
adowling2 Aug 13, 2024
1ded5df
Merge pull request #34 from adowling2/pyomo-tlab2
jakekrell Aug 13, 2024
507317c
update prior to new training data
jakekrell Aug 13, 2024
28b0006
Merge branch 'tclab' of https://github.com/jakekrell/FoKL-GPy into tclab
jakekrell Aug 13, 2024
f54b76f
Merge pull request #9 from jakekrell/tclab
adowling2 Aug 13, 2024
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
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
src/FoKL/__pycache__/
.idea/.gitignore
.idea/misc.xml
.idea/modules.xml
.idea/tclab.iml
.idea/vcs.xml
.idea/inspectionProfiles/profiles_settings.xml
.idea/inspectionProfiles/Project_Default.xml
62 changes: 62 additions & 0 deletions docs/_dev/fokl_to_pyomo__.20240723.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
```python
fokl_to_pyomo(self, xvars, yvar, m=None, t=None, scenarios=None)
```

---

```python
s = scenarios

if t is None and s is None:
ts = None
else:
if t is None:
ts = s
elif s is None:
ts = t
else:
ts = [t, s]
```

---

If ```xvars``` or ```yvar``` are strings,

```python
for j in len(xvars):
if isinstance(xvars[j], str):
xvars[j] = pyo.Var(ts, bounds=self.minmax[j])

if isinstance(yvar, str):
yvar = pyo.Var(ts)
```

---

If ```s```,

- ```m.GPi[(t), s] # == pyo.Constraint(yvar == m.GPi_y)```
- ```m.GPi_y[(t), s]```
- ```m.GPi_beta[s, term]```
- assume the most recent GP draws are the Pyomo scenarios; that is, ```= self.betas[-(s + 1), term]```.

Else,

- ```m.GPi[(t)] # == pyo.Constraint(yvar == m.GPi_y)```
- ```m.GPi_y[(t)]```
- ```m.GPi_beta[term]```
- assume the average of the GP draws are the single Pyomo scenario; that is, ```= np.mean(self.betas, axis=0)[term]```.

Note ```xvars``` and ```yvar``` are not required to be indexed by ```s```.

---

If ```t```,

- ```m.GPi[t, (s)] # == pyo.Constraint(yvar == m.GPi_y)```
- ```m.GPi_y[t, (s)]```

Note at least one variable in ```[xvars, yvar]``` must be indexed by ```t```.



2 changes: 1 addition & 1 deletion examples/pyomo_multiple_models/pyomo_multiple_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Then, T will be found to maximize abs(G).
"""
from FoKL import FoKLRoutines
from FoKL.fokl_to_pyomo import fokl_to_pyomo
from FoKL.fokl_to_pyomo__old import fokl_to_pyomo
import os
dir = os.path.abspath(os.path.dirname(__file__)) # directory of script
# # -----------------------------------------------------------------------
Expand Down
617 changes: 617 additions & 0 deletions examples/pyomo_tclab/_old/estimate_ode_model.ipynb

Large diffs are not rendered by default.

212 changes: 212 additions & 0 deletions examples/pyomo_tclab/_old/fokl_to_pyomo_validation.ipynb

Large diffs are not rendered by default.

2,245 changes: 2,245 additions & 0 deletions examples/pyomo_tclab/_old/pyomo_tclab_experiment_design.ipynb

Large diffs are not rendered by default.

337 changes: 337 additions & 0 deletions examples/pyomo_tclab/_old/pyomo_tclab_experiment_design2.ipynb

Large diffs are not rendered by default.

358 changes: 358 additions & 0 deletions examples/pyomo_tclab/_old/pyomo_tclab_experiment_design3.ipynb

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading
Loading