-
Notifications
You must be signed in to change notification settings - Fork 30
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
Improve argument processing of tranquilo #446
Conversation
Codecov Report
@@ Coverage Diff @@
## main #446 +/- ##
==========================================
+ Coverage 92.99% 93.05% +0.05%
==========================================
Files 247 250 +3
Lines 18482 18597 +115
==========================================
+ Hits 17188 17305 +117
+ Misses 1294 1292 -2
... and 4 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Three minor points. After they are fixed I'll run another benchmark and then we can merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great PR. This is an important step forward to disentangle the actual algorithm development of tranquilo and its options management.
Problems
target_sample_size
depends on themodel_type
; The defaultmodel_type
depends on thefunctype
. But themodel_type
can also be overwritten by the user. If so, we need to check that the user specified a valid model type before we can create the defaulttarget_sample_size
. I.e. everything is entangled and the order of processing stuff has to be chosen very carefully.Solution
options.py
; If default values depend on other arguments, we implementgetter_functions
, e.g.get_default_radius_options(x)
options.py
; In particular, all the logic related to combining default options and user options is inprocess_arguments.py
.tranquilo
function only callsprocess_arguments
and then calls_internal_tranquilo
with the processed arguments. This removes all namespace cluttering. A small trick to avoid long lists of arguments, the outertranquilo
functions only uses*args, **kwargs
as arguments andfunctools.wraps(process_arguments
) to get the right signature and docstring.Alternatives
We could use dags to figure out the order of everything, but we currently do not have dags as a dependency and we don't need it anywhere else. In any case, the current PR gets us closer to a situation where we could use dags.
To-Do
_internal_tranquilo
_new_tranquilo
to_tranquilo
RadiusOptions.initial_radius
a mandatory argument without default valueoptions.py
. Example:SubsolverOptions
that contains everything thedefault_options
dict insolve_subproblem
containsget_component
sucht that the user_options can be NamedTuples on which we call_asdict
solve_subproblem
instead of defining a dict thereaggregate_models
intoget_default_aggregator
if possible.Discuss
AcceptanceOptions
into individual options inacceptance_decision.py
.