opty icon indicating copy to clipboard operation
opty copied to clipboard

Allow symbolic objectives to be passed directly to Problem.

Open moorepants opened this issue 5 months ago • 4 comments

Fixes #202.

moorepants avatar Nov 02 '25 10:11 moorepants

Maybe the only thing to consider here is whether there is a better way to manage the API given you only need to pass in a single argument instead of both the objective and gradient functions.

moorepants avatar Nov 02 '25 10:11 moorepants

We could do Problem.__init__(*args, ...) and then count the number of arguments so that you could skip the gradient function.

moorepants avatar Nov 02 '25 10:11 moorepants

We could also make a second Problem as SymProblem that takes the new arguments.

Or do a Problem.from_symbolic() alternative initializer.

moorepants avatar Nov 02 '25 10:11 moorepants

If I understand correctly: if the objective function is given symbolically you essentially want to move

obj, obj_grad = create_objective_function(....)

inside of Problem?

Peter230655 avatar Nov 02 '25 10:11 Peter230655