Repository navigation
Conversation
|
@blnicho @adowling2 @slilonfe5 @smondal13 The following choices need to be made for a robust implementation:
Will continue working on this tomorrow, but wanted to share starting progress. Thank you and please let me know if you have any strong opinions on these design choices. |
…r_options are both given
|
Thank you @smondal13 for reminding me this is done in DoE for reference. From previous message:
@adowling2 Please let me know if you disagree with any of these decisions. |
|
@sscini I agree with these design decisions. One wringle. For debugging, it could be desirable to set a solver option, such as iter=0, for one of the steps. I am okay if we defer that. But this has come up in the past when I have wanted to debug one of the solvers in Pyomo.DoE or ParmEst. |
| """ | ||
| if isinstance(solver, str): | ||
| solver_name = solver | ||
| solver = SolverFactory(solver_name) |
There was a problem hiding this comment.
Do you know the type or error raised when the solver name is unknown? If yes, it’s safer to put this in a try-except block.
There was a problem hiding this comment.
An error is not raised until you try to solve it. It instead creates an UnknownSolver, which is why I check for that after this step.
| e.g., step=0.02 is a 2% perturbation | ||
| solver : str | ||
| Solver name specified by the user, e.g., 'ipopt' | ||
| solver : str or ``solver`` object |
There was a problem hiding this comment.
Use the appropriate data type for the solver object. str is a data type, solver object is not
There was a problem hiding this comment.
Each solver returns its own object type. I am looking into how to better represent this. This is what is currently in the docstring for DoE.
| e.g., step=0.02 is a 2% perturbation | ||
| solver : str | ||
| Solver name specified by the user, e.g., 'ipopt' | ||
| solver : str or ``solver`` object |
There was a problem hiding this comment.
Same comment about solver object data type. Also, you gave an explicit example of the solver name, but did not give an explicit example of the solver object
| e.g., step=0.02 is a 2% perturbation | ||
| solver : str | ||
| Solver name specified by the user, e.g., 'ipopt' | ||
| solver : str or ``solver`` object |
There was a problem hiding this comment.
Same comment about solver object data type. You gave an explicit example of the solver name, but did not give an explicit example of the solver object
| Dictionary containing the estimates of the unknown parameters | ||
| solver : str | ||
| Solver name specified by the user, e.g., 'ipopt' | ||
| solver : str or ``solver`` object |
There was a problem hiding this comment.
Same comment about solver object data type. You gave an explicit example of the solver name, but did not give an explicit example of the solver object
| regularization_weight: float, optional | ||
| Weighting factor for the regularization term. Used with | ||
| ``regularization="L2"``. Default is 1.0. | ||
| solver: str or ``solver`` object, optional |
There was a problem hiding this comment.
Same comment about solver object data type. You gave an explicit example of the solver name, but did not give an explicit example of the solver object
| Default is None. | ||
| solver : str, optional | ||
| Solver to use for optimization. Default is "ef_ipopt". | ||
| solver : str or ``solver`` object, optional |
There was a problem hiding this comment.
Same comment about solver object data type. You gave an explicit example of the solver name, but did not give an explicit example of the solver object
| raise RuntimeError("k_aug no longer supported.") | ||
| if solver == "ef_ipopt": | ||
| sol = SolverFactory('ipopt') | ||
| sol = self.solver |
There was a problem hiding this comment.
self.solver is constructed from whatever argument the user supplies in the Estimator class. The solver from “ef_ipopt” may not be the same as that from self.solver. Unless we want sol to be whatever self.solver is
There was a problem hiding this comment.
I missed this part thanks. In the current implementation (on main) using ef_ipopt just pointed to the default, so I was keeping the same option as the default in case people explicitly put it for backwards compatibility. Will rethink a smarter way to do this. In reality it would get the value from theta_est like with cov_est and _cov_at_theta
| e.g., 'finite_difference' | ||
| solver : str | ||
| Solver name specified by the user, e.g., 'ipopt' | ||
| solver : ``solver`` object |
There was a problem hiding this comment.
Why only solver object here? Why removing the option to supply a string?
There was a problem hiding this comment.
My reasoning was that since it is the private function for cov_est, the input for cov_est will be converted into a solver object with _get_solver() from a string, so it would never reach _cov_at_theta as a string.
| ---------- | ||
| solver: str, optional | ||
| Currently only "ef_ipopt" is supported. Default is "ef_ipopt". | ||
| solver: str or ``solver`` object, optional |
There was a problem hiding this comment.
Same comment about solver object data type. You gave an explicit example of the solver name, but did not give an explicit example of the solver object
| Default is 'finite_difference' | ||
| solver : str, optional | ||
| Solver name, e.g., 'ipopt'. Default is 'ipopt' | ||
| solver : str or ``solver`` object, optional |
There was a problem hiding this comment.
Same comment about solver object data type. You gave an explicit example of the solver name, but did not give an explicit example of the solver object
Fixes # .
Summary/Motivation:
Add ability to support solver objects in ParmEst instead of a solver string for opt SolverFactory.
Changes proposed in this PR:
AI-Use Disclosure
or
AI tools contributed to the development of this PR
Review process (select ONE):
Notes for reviewers (optional):
Legal Acknowledgement
By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution: