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

Builder Pattern for defining control problems #692

Closed
MichalKononenko opened this issue May 6, 2017 · 4 comments
Closed

Builder Pattern for defining control problems #692

MichalKononenko opened this issue May 6, 2017 · 4 comments
Assignees
Labels
code code-related, independently on the underlying physics simulation. control about the optomal control submodule

Comments

@MichalKononenko
Copy link

The optimize_pulse API takes in a lot of optional arguments. Wouldn't it make more sense to use a builder pattern to define a control problem in a ControlProblem class?

@nonhermitian
Copy link
Member

@ajgpitch Any thoughts on this one?

@quantshah
Copy link
Member

Hi, I was reading about builder patterns and came across this discussion which seems to suggest that builder patterns are not necessarily needed in Python. Instead, all the functions could probably be bundled into a single PulseOptimizer class and whatever the wrapper functions are doing right now can be methods of this class. The input arguments can be initialised in the init of this class. This you could have something like

from qutip.control.pulseoptim import PulseOptimizer

optimizer = PulseOptimizer(drift="", ctlr="", ....)
crab = optimizer.opt_pulse_crab(args, ...)
unitary_crab = optimizer.opt_pulse_crab_unitary(args,...)

@MichalKononenko - if you are suggesting something like this then perhaps it is that same as what I suggested on top.

@Ericgig Ericgig added the control about the optomal control submodule label Feb 21, 2019
@nathanshammah nathanshammah added the code code-related, independently on the underlying physics simulation. label Dec 2, 2019
@metalcyanide
Copy link

I would agree with what @quantshah had said. Builder patterns are useful in those languages like Java, where named parameters is not in-built. All functions bundled into a single class would be better alternative. This would help when adding new methods that differs in optimization algorithm to the class.

@jakelishman
Copy link
Member

Closing this now due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code code-related, independently on the underlying physics simulation. control about the optomal control submodule
Projects
None yet
Development

No branches or pull requests

8 participants