Skip to content

[Feature] Enable optional parameters for objective functions with functools #36

@samgdotson

Description

@samgdotson

Currently, all objectives and constraints in osier require two items, the list of technologies and a solved dispatch model. Some calculations will require tunable parameters. Such as a volatility calculation using weighted_permutation_entropy, for example. Therefore, allowing users to specify the optional parameters at run time with some thing like:

objectives = (func1, functools.partial(func2, m = 7, tau=60))

Where the second objective function func2 has some optional parameters that cannot be set once a simulation begins (except by using functools.partial).

Edit:
To clarify the desired behavior, users should be able to pass a function and it's parameters to osier without explicitly calling functools.partial. E.g.,

from osier import CapacityExpansion

problem = CapacityExpansion(..., objectives=[func1, {func2: {m:7, tau:60}}], ...)

Users would be required to know which parameters they need.

Conversation

@yardasol @ZoeRichter @smpark7 @nsryan2 @munkm

Does this functionality make sense? Which version is clearer? The clarification would add more complexity to the osier.CapacityExpansion object, but it's already so similar to the functools implementation that I'm not sure anymore if the "simplification" makes sense. Looking for thoughts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Comp:CoreThis issue has to do with the main bulk of the code or document. (methods, main content)Difficulty:3-ExpertThis issue is not only complicated, but also complex. It may require special advanced skills.Priority:3-DesiredThis work is important, but not urgent.Status:1-NewNo one has claimed this issue yet. It is in need of solving.Type:FeatureNew feature or feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions