question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Iterable access to solver results and possibility of feedback to solvers

See original GitHub issue

Currently QuTiP solvers are pure batch jobs. One calls a function, e.g. mesolve, which then runs until the state has been propagated to all requested time steps and then the function returns the result.

There are a variety of use cases where having access to results as they are calculated can be useful:

  • Implementing a progress bar
  • Limiting how long a solver runs for
  • Stopping a solver early if a steady state or other desired or undesired state is detected.
  • Implementing adaptive solvers where parameters are changed depending on the current state

We’re currently refactoring the QuTiP solvers for QuTiP v5, so perhaps now is a good time to consider whether this feature will see enough use to be worth the effort.

Implementation options:

  • The solver could call a callback function each time a new result becomes available.
  • The solver could yield each time a new result becomes available.
  • The solver could do something asynchronous (I think this is not worth supporting natively in QuTiP – either of the others would allow something asynchronous to be implemented by a QuTiP users themselves if they wanted).

Probably these are not mutually exclusive. To make porting easier, it should still be possible to call some solve function without a callback or yielding as one can do now.

Related issues:

  • qucontrol/krotov#93

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
hodgestarcommented, Aug 24, 2022

The new QuTiP solvers now support solver.step(self, t, args=args). which allows manually stepping the state until time t with the optional supplied args. I don’t think this quite addresses the full feedback possibilities, but I am noting the progress here.

1reaction
Ericgigcommented, Jun 11, 2021

Most of scipy’s solver are not “thread-safe”, but we will be able to use other solvers in the new version. We will be sure to add at least one which is thread safe.

The args=new_args refer to the args in [H0, [H1, f(t, args)]], in your case, you could use something like:

def f(t, args):
    return args['u'] 

We don’t have step interpolation with changing coefficient array. It could be added, but we will have to think about it. Using a mutable, as in your example, would create error with most ODE solver with variable step, so I would not recommend it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Iterable access to solver results and possibility of feedback to solvers
Currently QuTiP solvers are pure batch jobs. One calls a function, e.g. mesolve , which then runs until the state has been propagated...
Read more >
Account Roles and Permissions - Iterable Support Center
Custom roles are bundles of permissions that give team members access to the Iterable features and resources they need to efficiently do their...
Read more >
Pyomo Documentation - Read the Docs
This section provides an introduction to Pyomo: Python Optimization Modeling Objects. A more complete description.
Read more >
PyROS Solver — Pyomo 6.4.4 documentation
Subordinate local and global NLP optimization solvers. Below is a list of arguments that PyROS expects the user to provide when calling the...
Read more >
Iterable Reviews 2022: Details, Pricing, & Features - G2
The updates to the platform have made creating comms extremely fast and easy to preview, proof, and get quick feedback on. Our onboarding...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found