Skip to content
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

Allow Problem to accept symbolic objectives. #202

Open
moorepants opened this issue Aug 4, 2024 · 0 comments
Open

Allow Problem to accept symbolic objectives. #202

moorepants opened this issue Aug 4, 2024 · 0 comments

Comments

@moorepants
Copy link
Member

Timo suggested:

# Assume obj and obj_grad are passed
obj = args[0] if args else kwargs.get("obj")
obj_grad args[1] if len(args)>1 else kwargs.get("obj_grad")
It "obj_expr" in kwargs:
    if isinstance(args[0], Callable) or isinstance(args[1], Callable):
         raise ValueError("The objective function should be provided either as expression ('obj_expr')or as two evaluation functions ('obj', 'obj_grad').")
    obj, obj_grad = create_objective_function(...)
else:
    args = args[2:]  # Something like this

in #122 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant