dowlinglab / pyomo-doe

Workshop tutorials for Pyomo.DoE
BSD 3-Clause "New" or "Revised" License
9 stars 1 forks source link

Determine if bounding FIM diagonal helps #1

Open adowling2 opened 1 month ago

adowling2 commented 1 month ago

Workshop DoE tutorial (D-optimality) without bounds:

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
 270 -6.3717500e+01 2.48e-01 4.73e-10  -5.7 7.41e+02    -  1.00e+00 1.00e+00h  1
 271 -6.3717501e+01 3.53e-02 4.75e-11  -5.7 2.39e+02    -  1.00e+00 1.00e+00h  1
 272 -6.3717501e+01 5.20e-04 1.86e-11  -5.7 2.85e+01    -  1.00e+00 1.00e+00h  1
 273 -6.3717501e+01 9.54e-07 1.84e-11  -5.7 6.05e-01    -  1.00e+00 1.00e+00h  1

Number of Iterations....: 273

                                   (scaled)                 (unscaled)
Objective...............:  -6.3717500978790582e+01   -6.3717500978790582e+01
Dual infeasibility......:   1.8449191864084581e-11    1.8449191864084581e-11
Constraint violation....:   2.3841857910156250e-07    9.5367431640625000e-07
Complementarity.........:   1.8449144625279781e-06    1.8449144625279781e-06
Overall NLP error.......:   1.8449144625279781e-06    1.8449144625279781e-06

Number of objective function evaluations             = 518
Number of objective gradient evaluations             = 274
Number of equality constraint evaluations            = 524
Number of inequality constraint evaluations          = 0
Number of equality constraint Jacobian evaluations   = 274
Number of inequality constraint Jacobian evaluations = 0
Number of Lagrangian Hessian evaluations             = 273
Total CPU secs in IPOPT (w/o function evaluations)   =    122.502
Total CPU secs in NLP function evaluations           =      0.710

EXIT: Optimal Solution Found.
INFO: elapsed time: 130.2 seconds

Workshop DoE tutorial (A-optimality) without bounds:

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
   0 -2.2332658e+01 4.96e-05 1.00e+00  -1.0 0.00e+00    -  0.00e+00 0.00e+00   0
Reallocating memory for MA57: lfact (2767123)
   1 -2.2332658e+01 2.16e-03 9.71e-03  -1.0 3.40e+00  -4.0 9.90e-01 1.00e+00f  1
   2 -2.2332658e+01 1.73e+01 4.14e-03  -1.0 9.06e+01  -4.5 9.90e-01 1.00e+00f  1
   3 -2.2332630e+01 1.01e+01 2.76e-02  -1.0 1.49e+05    -  9.90e-01 1.00e+00F  1
   4 -2.2332623e+01 8.32e+02 7.28e-05  -1.0 3.66e+04    -  9.90e-01 1.00e+00f  1
   5 -2.2332625e+01 3.69e+01 1.00e-06  -1.0 8.57e+03    -  9.92e-01 1.00e+00h  1
   6 -2.2332625e+01 1.23e-03 3.71e-06  -1.0 3.19e-01  -5.0 1.00e+00 1.00e+00h  1
   7 -2.2332625e+01 1.77e-05 2.83e-08  -2.5 5.19e+00    -  1.00e+00 1.00e+00h  1
   8 -2.2332625e+01 1.05e-06 4.84e-09  -3.8 1.31e-03  -5.4 1.00e+00 1.00e+00h  1
   9 -2.2332625e+01 1.13e-06 1.89e-10  -5.7 1.38e-04  -5.9 1.00e+00 1.00e+00h  1

Number of Iterations....: 9

                                   (scaled)                 (unscaled)
Objective...............:  -2.2332624787764505e+01   -2.2332624787764505e+01
Dual infeasibility......:   1.8937282053839241e-10    1.8937282053839241e-10
Constraint violation....:   1.1279450973233907e-06    1.1279450973233907e-06
Complementarity.........:   1.8449754497132876e-06    1.8449754497132876e-06
Overall NLP error.......:   1.8449754497132876e-06    1.8449754497132876e-06

Number of objective function evaluations             = 10
Number of objective gradient evaluations             = 10
Number of equality constraint evaluations            = 11
Number of inequality constraint evaluations          = 0
Number of equality constraint Jacobian evaluations   = 10
Number of inequality constraint Jacobian evaluations = 0
Number of Lagrangian Hessian evaluations             = 9
Total CPU secs in IPOPT (w/o function evaluations)   =      3.482
Total CPU secs in NLP function evaluations           =      0.022

EXIT: Optimal Solution Found.
INFO: elapsed time: 9.6 seconds

Workshop DoE exercise (D-optimality) without bounds:

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
 300 -6.3136819e+01 3.55e-04 1.42e-08  -6.0 1.22e+02  -9.9 1.00e+00 1.00e+00H  1
 301 -6.3136833e+01 5.02e-01 1.64e-09  -6.0 1.04e+03    -  1.00e+00 1.00e+00h  1
 302 -6.3136823e+01 1.53e-02 1.18e-11  -6.0 1.23e+02    -  1.00e+00 1.00e+00h  1
 303 -6.3136823e+01 1.31e-04 9.11e-12  -6.0 1.33e+01    -  1.00e+00 1.00e+00h  1
 304 -6.3136823e+01 4.77e-07 9.09e-12  -6.0 8.69e-03    -  1.00e+00 1.00e+00h  1

Number of Iterations....: 304

                                   (scaled)                 (unscaled)
Objective...............:  -6.3136822636497925e+01   -6.3136822636497925e+01
Dual infeasibility......:   9.0909095928976199e-12    9.0909095928976199e-12
Constraint violation....:   2.9802322387695312e-08    4.7683715820312500e-07
Complementarity.........:   9.0909090925791440e-07    9.0909090925791440e-07
Overall NLP error.......:   9.0909090925791440e-07    9.0909090925791440e-07

Number of objective function evaluations             = 652
Number of objective gradient evaluations             = 305
Number of equality constraint evaluations            = 663
Number of inequality constraint evaluations          = 0
Number of equality constraint Jacobian evaluations   = 305
Number of inequality constraint Jacobian evaluations = 0
Number of Lagrangian Hessian evaluations             = 304
Total CPU secs in IPOPT (w/o function evaluations)   =    138.332
Total CPU secs in NLP function evaluations           =      0.838

EXIT: Optimal Solution Found.
INFO: elapsed time: 144.7 seconds

Workshop DoE exercise (A-optimality) without bounds:

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
   0 -2.2064871e+01 1.15e-06 1.00e+00  -1.0 0.00e+00    -  0.00e+00 0.00e+00   0
   1 -2.2064871e+01 5.61e-02 1.00e-02  -1.0 3.43e+02    -  9.90e-01 1.00e+00f  1
   2 -2.2064864e+01 3.74e+02 3.33e-03  -1.0 2.84e+04    -  9.90e-01 1.00e+00f  1
   3 -2.2064836e+01 1.39e+02 1.47e-02  -1.0 1.15e+05    -  9.90e-01 1.00e+00F  1
   4 -2.2064834e+01 2.11e+01 7.33e-05  -1.0 5.76e+03    -  9.90e-01 1.00e+00h  1
   5 -2.2064834e+01 6.89e-04 1.00e-06  -1.0 4.37e+01    -  9.93e-01 1.00e+00h  1
   6 -2.2064834e+01 4.77e-07 2.00e-07  -1.7 6.58e-02    -  1.00e+00 1.00e+00h  1
   7 -2.2064834e+01 6.43e-07 1.50e-09  -3.8 4.02e-01    -  1.00e+00 1.00e+00h  1
   8 -2.2064835e+01 1.73e-03 1.84e-11  -5.7 5.37e+01    -  1.00e+00 1.00e+00h  1
   9 -2.2064836e+01 1.14e+01 1.84e-11  -5.7 4.35e+03    -  1.00e+00 1.00e+00h  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  10 -2.2064836e+01 4.77e-07 1.84e-11  -5.7 1.26e+01    -  1.00e+00 1.00e+00h  1

Number of Iterations....: 10

                                   (scaled)                 (unscaled)
Objective...............:  -2.2064835649769577e+01   -2.2064835649769577e+01
Dual infeasibility......:   1.8449144625279504e-11    1.8449144625279504e-11
Constraint violation....:   4.7683715820312500e-07    4.7683715820312500e-07
Complementarity.........:   1.8449144625280065e-06    1.8449144625280065e-06
Overall NLP error.......:   1.8449144625280065e-06    1.8449144625280065e-06

Number of objective function evaluations             = 11
Number of objective gradient evaluations             = 11
Number of equality constraint evaluations            = 12
Number of inequality constraint evaluations          = 0
Number of equality constraint Jacobian evaluations   = 11
Number of inequality constraint Jacobian evaluations = 0
Number of Lagrangian Hessian evaluations             = 10
Total CPU secs in IPOPT (w/o function evaluations)   =      2.801
Total CPU secs in NLP function evaluations           =      0.022

EXIT: Optimal Solution Found.
INFO: elapsed time: 6.9 seconds
adowling2 commented 1 month ago

Workshop DoE tutorial (D-optimality) with bounds:

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
 490 -6.3650609e+01 7.89e-01 1.30e-07  -5.7 2.70e+01  -8.3 1.00e+00 1.00e+00f  1
 491 -6.3650692e+01 4.44e-02 2.14e-07  -5.7 1.32e+02  -8.8 7.05e-01 9.99e-01H  1
 492 -6.3650680e+01 7.92e-01 2.40e-07  -5.7 5.62e+01  -8.4 1.00e+00 1.00e+00f  1
 493 -6.3650723e+01 1.57e+00 2.29e-07  -5.7 2.33e+02  -8.8 2.52e-01 8.89e-02h  2
 494 -6.3650870e+01 5.89e-01 1.79e-07  -5.7 4.46e+01  -8.4 1.00e+00 8.98e-01H  1
 495 -6.3650944e+01 2.21e+00 2.51e-07  -5.7 2.34e+02  -8.9 4.47e-01 6.07e-01F  1
 496 -6.3651040e+01 5.92e-01 1.23e-07  -5.7 3.65e+01  -8.5 1.00e+00 1.00e+00f  1
 497 -6.3651029e+01 1.53e+00 1.21e-07  -5.7 6.77e+02  -8.9 8.18e-02 3.41e-02h  2
 498 -6.3650979e+01 2.24e+00 2.46e-07  -5.7 8.22e+01  -8.5 1.00e+00 1.00e+00h  1
 499 -6.3651047e+01 2.55e-01 2.42e-07  -5.7 3.03e+01  -8.1 1.00e+00 1.00e+00h  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
 500 -6.3651136e+01 4.34e+00 2.58e-07  -5.7 9.70e+01  -8.6 1.00e+00 1.00e+00h  1

Number of Iterations....: 500

                                   (scaled)                 (unscaled)
Objective...............:  -6.3651136294670096e+01   -6.3651136294670096e+01
Dual infeasibility......:   2.5831729480663131e-07    2.5831729480663131e-07
Constraint violation....:   4.3353678404819220e+00    4.3353678404819220e+00
Complementarity.........:   1.8668415352644537e-06    1.8668415352644537e-06
Overall NLP error.......:   4.3353678404819220e+00    4.3353678404819220e+00

Number of objective function evaluations             = 868
Number of objective gradient evaluations             = 501
Number of equality constraint evaluations            = 874
Number of inequality constraint evaluations          = 0
Number of equality constraint Jacobian evaluations   = 501
Number of inequality constraint Jacobian evaluations = 0
Number of Lagrangian Hessian evaluations             = 500
Total CPU secs in IPOPT (w/o function evaluations)   =    260.479
Total CPU secs in NLP function evaluations           =      1.286

EXIT: Maximum Number of Iterations Exceeded.
WARNING: Loading a SolverResults object with a warning status into
model.name="unknown";
    - termination condition: maxIterations
    - message from solver: Ipopt 3.13.2\x3a Maximum Number of Iterations
      Exceeded.
INFO: elapsed time: 270.1 seconds

Workshop DoE tutorial (A-optimality) with bounds:

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  10 -2.2332625e+01 6.01e+00 1.84e-11  -5.7 3.06e+03    -  1.00e+00 1.00e+00h  1
  11 -2.2332625e+01 4.92e-08 1.84e-11  -5.7 6.64e+00    -  1.00e+00 1.00e+00h  1

Number of Iterations....: 11

                                   (scaled)                 (unscaled)
Objective...............:  -2.2332625400881589e+01   -2.2332625400881589e+01
Dual infeasibility......:   1.8449144625279624e-11    1.8449144625279624e-11
Constraint violation....:   4.9210257202503271e-08    4.9210257202503271e-08
Complementarity.........:   1.8449144625279593e-06    1.8449144625279593e-06
Overall NLP error.......:   1.8449144625279593e-06    1.8449144625279593e-06

Number of objective function evaluations             = 12
Number of objective gradient evaluations             = 12
Number of equality constraint evaluations            = 13
Number of inequality constraint evaluations          = 0
Number of equality constraint Jacobian evaluations   = 12
Number of inequality constraint Jacobian evaluations = 0
Number of Lagrangian Hessian evaluations             = 11
Total CPU secs in IPOPT (w/o function evaluations)   =      3.572
Total CPU secs in NLP function evaluations           =      0.024

EXIT: Optimal Solution Found.
INFO: elapsed time: 9.4 seconds

Workshop DoE exercise (D-optimality) with bounds:

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
 310 -6.3129186e+01 2.91e-03 9.44e-09  -5.7 3.24e+00  -8.5 1.00e+00 1.00e+00h  1
 311 -6.3129212e+01 3.56e-01 9.15e-08  -5.7 2.59e+03    -  1.00e+00 3.14e-01h  2
 312 -6.3129243e+01 8.80e-04 1.46e-09  -5.7 2.11e+03    -  1.00e+00 1.00e+00H  1
 313 -6.3129240e+01 3.77e-05 6.82e-10  -5.7 7.04e-01  -9.0 1.00e+00 1.00e+00h  1
 314 -6.3129240e+01 4.09e-06 3.45e-10  -5.7 1.07e+00  -9.5 1.00e+00 1.00e+00H  1

Number of Iterations....: 314

                                   (scaled)                 (unscaled)
Objective...............:  -6.3129240036018487e+01   -6.3129240036018487e+01
Dual infeasibility......:   3.4514864037490920e-10    3.4514864037490920e-10
Constraint violation....:   4.0938612073659897e-06    4.0938612073659897e-06
Complementarity.........:   1.8449144625279510e-06    1.8449144625279510e-06
Overall NLP error.......:   4.0938612073659897e-06    4.0938612073659897e-06

Number of objective function evaluations             = 703
Number of objective gradient evaluations             = 315
Number of equality constraint evaluations            = 717
Number of inequality constraint evaluations          = 0
Number of equality constraint Jacobian evaluations   = 315
Number of inequality constraint Jacobian evaluations = 0
Number of Lagrangian Hessian evaluations             = 314
Total CPU secs in IPOPT (w/o function evaluations)   =    148.430
Total CPU secs in NLP function evaluations           =      0.910

Workshop DoE exercise (A-optimality) with bounds:

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
   0 -2.2064871e+01 1.15e-06 1.00e+00  -1.0 0.00e+00    -  0.00e+00 0.00e+00   0
   1 -2.2064871e+01 5.56e-02 1.00e-02  -1.0 3.41e+02    -  9.90e-01 1.00e+00f  1
   2 -2.2064871e+01 5.02e+00 1.03e-03  -1.0 9.27e+00  -4.0 9.90e-01 1.00e+00f  1
   3 -2.2064831e+01 1.73e+00 7.16e-03  -1.0 1.65e+05    -  9.90e-01 1.00e+00F  1
   4 -2.2064834e+01 8.33e+01 1.62e-06  -1.0 1.14e+04    -  9.90e-01 1.00e+00h  1
   5 -2.2064834e+01 4.07e-02 1.00e-06  -1.0 1.37e+02    -  9.93e-01 1.00e+00h  1
   6 -2.2064834e+01 4.77e-07 2.00e-07  -1.7 1.32e-01    -  1.00e+00 1.00e+00h  1
   7 -2.2064834e+01 8.94e-08 1.50e-09  -3.8 4.03e-01    -  1.00e+00 1.00e+00h  1
   8 -2.2064834e+01 1.73e-03 6.02e-11  -5.7 5.36e+01    -  1.00e+00 1.00e+00h  1
   9 -2.2064836e+01 1.14e+01 1.84e-11  -5.7 4.34e+03    -  1.00e+00 1.00e+00h  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  10 -2.2064836e+01 1.81e-08 1.84e-11  -5.7 1.25e+01    -  1.00e+00 1.00e+00h  1

Number of Iterations....: 10

                                   (scaled)                 (unscaled)
Objective...............:  -2.2064835588299044e+01   -2.2064835588299044e+01
Dual infeasibility......:   1.8449144625279582e-11    1.8449144625279582e-11
Constraint violation....:   1.8088485376210883e-08    1.8088485376210883e-08
Complementarity.........:   1.8449144625280084e-06    1.8449144625280084e-06
Overall NLP error.......:   1.8449144625280084e-06    1.8449144625280084e-06

Number of objective function evaluations             = 11
Number of objective gradient evaluations             = 11
Number of equality constraint evaluations            = 12
Number of inequality constraint evaluations          = 0
Number of equality constraint Jacobian evaluations   = 11
Number of inequality constraint Jacobian evaluations = 0
Number of Lagrangian Hessian evaluations             = 10
Total CPU secs in IPOPT (w/o function evaluations)   =      3.011
Total CPU secs in NLP function evaluations           =      0.023

EXIT: Optimal Solution Found.
INFO: elapsed time: 7.2 seconds
adowling2 commented 1 month ago

Which constraints were infeasible for D-optimality?

from idaes.core.util.model_diagnostics import DiagnosticsToolbox

dt = DiagnosticsToolbox(optimize_result2.model, constraint_residual_tolerance=1.0)
dt.display_constraints_with_large_residuals()

Giving:

====================================================================================
The following constraint(s) have large residuals (>1.0E+00):

    fim_constraint[Ub,inv_CpH]: 1.27402E+00
    fim_constraint[inv_CpH,Ub]: 1.27402E+00
    fim_constraint[inv_CpH,inv_CpH]: 4.33537E+00
    fim_constraint[inv_CpH,inv_CpS]: 1.27923E+00
    fim_constraint[inv_CpS,inv_CpH]: 1.27923E+00

====================================================================================

Conclusion: disable the FIM diagonal bound for now. Revisit using grey box to construct the FIM and compute the objective.