Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
cdd7d52
Work on multistart implement 4/23 morning
sscini Apr 23, 2025
eca0ba8
Finished first draft of pseudocode for multistart
sscini Apr 23, 2025
2160aec
Fixed logical errors in pseudocode
sscini Apr 23, 2025
266beea
Started implementing review comments 4/30
sscini Apr 30, 2025
b877ada
Merge branch 'Pyomo:main' into multistart-in-parmest
sscini Apr 30, 2025
9f1ffe5
Work on edits, 5/1/25
sscini May 1, 2025
43f1ab3
Merge branch 'Pyomo:main' into multistart-in-parmest
sscini May 1, 2025
ea067c8
Made edits, still debugging
sscini May 2, 2025
3b839ef
Addressed some comments in code. Still working through example to debug
sscini May 14, 2025
3a7aa1d
Merge branch 'Pyomo:main' into multistart-in-parmest
sscini May 14, 2025
c688f2d
Merge branch 'Pyomo:main' into multistart-in-parmest
sscini May 21, 2025
50c36bc
Got dataframe formatted, still working on executing Q_opt
sscini May 21, 2025
8e5f078
Merge branch 'Pyomo:main' into multistart-in-parmest
sscini Jun 2, 2025
f4c7018
Working code, adding features 6/2/25
sscini Jun 2, 2025
4444e6d
Merge branch 'Pyomo:main' into multistart-in-parmest
sscini Jun 3, 2025
e788000
Added questions for next round of reviews
sscini Jun 3, 2025
4429caf
Merge branch 'multistart-in-parmest' of https://github.com/sscini/pyo…
sscini Jun 3, 2025
f071718
Removed diagnostic tables to simplify output
sscini Jun 3, 2025
9b1545d
Work from Wednesday of Sprint week
sscini Jun 4, 2025
80079cb
Create Simple_Multimodal_Multistart.ipynb
sscini Jun 4, 2025
1695519
New features Thursday morning
sscini Jun 5, 2025
0634014
First successful running multistart feature, before Alex recommended …
sscini Jun 5, 2025
a959346
Merge branch 'Pyomo:main' into multistart-in-parmest
sscini Jun 5, 2025
04a9096
Merge branch 'Pyomo:main' into multistart-in-parmest
sscini Jun 23, 2025
06e0a72
Ran black, removed temp example
sscini Jun 24, 2025
6b3ee40
Added utility to update model using suffix values
sscini Jun 27, 2025
5cadfac
Work on Friday 6/27 applying PR comments
sscini Jun 27, 2025
922fd57
Merge branch 'Pyomo:main' into multistart-in-parmest
sscini Jun 30, 2025
1be2d9e
Addressed some reviewer comments and ran black.
sscini Jun 30, 2025
56800f5
Merge branch 'Pyomo:main' into multistart-in-parmest
sscini Jul 1, 2025
05381c5
Updated argument for theta_est_multistart
sscini Jul 6, 2025
5b4f9c1
Merge branch 'Pyomo:main' into multistart-in-parmest
sscini Jul 7, 2025
07ae1e8
Addressed majority of review comments. State before 7/8 dev meeting
sscini Jul 8, 2025
33d838f
Fixing conflict
sscini Jul 8, 2025
65a9cff
Merge branch 'main' into multistart-in-parmest
sscini Jul 15, 2025
90093df
Merge branch 'Pyomo:main' into multistart-in-parmest
sscini Jul 17, 2025
e7b2df1
Added in TODO items based on Dan morning meeting
sscini Jul 17, 2025
c55143d
Added in files from main now, removed example
sscini Feb 19, 2026
8f3a902
Merge branch 'Pyomo:main' into multistart-in-parmest
sscini Feb 19, 2026
3c87d7a
Added old files in temporarily for reference
sscini Feb 19, 2026
4e09d33
Ran black
sscini Feb 19, 2026
4f94329
Merge branch 'Q_opt-redesign' into multistart-in-parmest
sscini Feb 19, 2026
12d0af1
Made quick working example, and small modification for multistart
sscini Feb 19, 2026
0a1167d
Merge branch 'main' into multistart-in-parmest
sscini Feb 24, 2026
9ccfba4
Added theta generation and old multistart over
sscini Mar 3, 2026
78f65f3
Updated multistart example and code
sscini Mar 3, 2026
43a67ab
Added bounds to models, ran black
sscini Mar 3, 2026
2b41ba5
Merge branch 'Pyomo:main' into multistart-in-parmest
sscini Mar 6, 2026
2e5ac42
Merge branch 'Q_opt-redesign' into multistart-in-parmest
sscini Mar 6, 2026
813a981
Adjusted implementation, added new tests in separate file
sscini Mar 6, 2026
44a0b83
Merge branch 'Pyomo:main' into multistart-in-parmest
sscini Mar 6, 2026
f9c8e3a
Fixed issue with repeat thetas, ran black
sscini Mar 9, 2026
12a3c1b
Merge branch 'main' into multistart-in-parmest
sscini Mar 24, 2026
664d687
Merge branch 'Q_opt-redesign' into multistart-in-parmest
sscini Mar 27, 2026
5530e9d
Merge branch 'Pyomo:main' into multistart-in-parmest
sscini Apr 7, 2026
aa30f0c
Merge branch 'Pyomo:main' into multistart-in-parmest
sscini May 14, 2026
1a1a7c0
Merge branch 'Q_opt-redesign' into multistart-in-parmest
sscini May 14, 2026
b4518fc
Merge branch 'main' into multistart-in-parmest
sscini May 15, 2026
800143f
Merge branch 'Pyomo:main' into multistart-in-parmest
sscini May 21, 2026
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# ____________________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and Engineering
# Solutions of Sandia, LLC, the U.S. Government retains certain rights in this
# software. This software is distributed under the 3-clause BSD License.
# ____________________________________________________________________________________

from pyomo.common.dependencies import numpy as np, pandas as pd
from itertools import product
from os.path import join, abspath, dirname
import pyomo.contrib.parmest.parmest as parmest
from pyomo.contrib.parmest.examples.reactor_design.reactor_design import (
ReactorDesignExperiment,
)


def main():

# Read in data
file_dirname = dirname(abspath(str(__file__)))
file_name = abspath(join(file_dirname, "reactor_data.csv"))
data = pd.read_csv(file_name)

# Create an experiment list
exp_list = [ReactorDesignExperiment(data, i) for i in range(data.shape[0])]

# Solver options belong here (Ipopt options shown as example)
solver_options = {"max_iter": 1000, "tol": 1e-6}

pest = parmest.Estimator(
exp_list, obj_function="SSE", solver_options=solver_options
)

# Single-start estimation
obj, theta = pest.theta_est()
print("Single-start objective:", obj)
print("Single-start theta:\n", theta)

# Multistart estimation
results_df, best_theta, best_obj = pest.theta_est_multistart(
n_restarts=10,
multistart_sampling_method="uniform_random",
seed=42,
save_results=False, # True if you want CSV via file_name=
)

print("\nMultistart best objective:", best_obj)
print("Multistart best theta:", best_theta)
print("\nAll multistart results:")
print(results_df)


if __name__ == "__main__":
main()
10 changes: 7 additions & 3 deletions pyomo/contrib/parmest/examples/reactor_design/reactor_design.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@ def reactor_design_model():
model = pyo.ConcreteModel()

# Rate constants, make unknown parameters variables
model.k1 = pyo.Var(initialize=5.0 / 6.0, within=pyo.PositiveReals) # min^-1
model.k2 = pyo.Var(initialize=5.0 / 3.0, within=pyo.PositiveReals) # min^-1
model.k1 = pyo.Var(
initialize=5.0 / 6.0, within=pyo.PositiveReals, bounds=(0.1, 10.0)
) # min^-1
model.k2 = pyo.Var(
initialize=5.0 / 3.0, within=pyo.PositiveReals, bounds=(0.1, 10.0)
) # min^-1
model.k3 = pyo.Var(
initialize=1.0 / 6000.0, within=pyo.PositiveReals
initialize=1.0 / 6000.0, within=pyo.PositiveReals, bounds=(1e-5, 1e-3)
) # m^3/(gmol min)

# Inlet concentration of A, gmol/m^3
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# ____________________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2026 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and Engineering
# Solutions of Sandia, LLC, the U.S. Government retains certain rights in this
# software. This software is distributed under the 3-clause BSD License.
# ____________________________________________________________________________________

from pyomo.common.dependencies import numpy as np, pandas as pd
from itertools import product
import pyomo.contrib.parmest.parmest as parmest
from pyomo.contrib.parmest.examples.rooney_biegler.rooney_biegler import (
RooneyBieglerExperiment,
)


def main():

# Data
data = pd.DataFrame(
data=[[1, 8.3], [2, 10.3], [3, 19.0], [4, 16.0], [5, 15.6], [7, 19.8]],
columns=['hour', 'y'],
)

# Create an experiment list
exp_list = []
for i in range(data.shape[0]):
exp_list.append(RooneyBieglerExperiment(data.loc[i, :]))

# View one model
# exp0_model = exp_list[0].get_labeled_model()
# exp0_model.pprint()

# Solver options belong here (Ipopt options shown as example)
solver_options = {"max_iter": 1000, "tol": 1e-6}

pest = parmest.Estimator(
exp_list, obj_function="SSE", solver_options=solver_options
)

# Single-start estimation
obj, theta = pest.theta_est()
print("Single-start objective:", obj)
print("Single-start theta:\n", theta)

# Multistart estimation
results_df, best_theta, best_obj = pest.theta_est_multistart(
n_restarts=10,
multistart_sampling_method="uniform_random",
seed=42,
save_results=False, # True if you want CSV via file_name=
)

print("\nMultistart best objective:", best_obj)
print("Multistart best theta:", best_theta)
print("\nAll multistart results:")
print(results_df)


if __name__ == "__main__":
main()
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def rooney_biegler_model(data, theta=None):
if theta is None:
theta = {'asymptote': 15, 'rate_constant': 0.5}

model.asymptote = pyo.Var(initialize=theta['asymptote'])
model.rate_constant = pyo.Var(initialize=theta['rate_constant'])
model.asymptote = pyo.Var(initialize=theta['asymptote'], bounds=(0.1, 100))
model.rate_constant = pyo.Var(initialize=theta['rate_constant'], bounds=(0, 10))

# Fix the unknown parameters
model.asymptote.fix()
Expand Down
Loading
Loading