csu-hmc / opty

A library for using direct collocation in the optimization of dynamic systems.
http://opty.readthedocs.io
Other
86 stars 20 forks source link

Make args and kwargs in Problem explicit (so default values are shown) #129

Closed Peter230655 closed 3 months ago

Peter230655 commented 4 months ago

This is optional, as I read the docs. midpoint and backward euler are available. Which one is the default value? (I would assume, that the default method is normally better)

Thanks!

moorepants commented 4 months ago

The default is backward euler.

moorepants commented 4 months ago

It is clear here:

opty.direct_collocation.ConstraintCollocator(equations_of_motion, state_symbols, num_collocation_nodes, node_time_interval, known_parameter_map={}, known_trajectory_map={}, instance_constraints=None, time_symbol=None, tmp_dir=None, integration_method='backward euler', parallel=False)

But we don't expose that in Problem:

class opty.direct_collocation.Problem(obj, obj_grad, *args, **kwargs)
Peter230655 commented 4 months ago

Thanks!! I must admit, that I have no idea what _opty.direct_collocation.ConstraintCollocator(equations_of_motion, state_symbols, num_collocation_nodes, node_time_interval, known_parameter_map={}, known_trajectory_map={}, instance_constraints=None, time_symbol=None, tmp_dir=None, integrationmethod='backward euler', parallel=False)

means.

moorepants commented 4 months ago

Reopening because it would be better to have all the args and kwargs be explicit in Problem.

moorepants commented 4 months ago

opty.direct_collocation.ConstraintCollocator(equations_of_motion, state_symbols, num_collocation_nodes, node_time_interval, known_parameter_map={}, known_trajectory_map={}, instance_constraints=None, time_symbol=None, tmp_dir=None, integration_method='backward euler', parallel=False)

Is the signature for the ConstraintCollocator class. It shows what arguments and keyword arguments it accepts and for the keyword arguments it shows what the default values are.

Peter230655 commented 4 months ago

I am ignorant in these things: What is the ConstraintCollocator class? Maybe too complicated to expalin to me.

moorepants commented 4 months ago

It is explained in the documentation: https://opty.readthedocs.io/en/latest/api.html#opty.direct_collocation.ConstraintCollocator

Peter230655 commented 4 months ago

Even printed out on my desk, but I never looked at it, as in the examples only Problem was used. I need to learn more about the basic structure of things like opty.