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

Initial equations and initialization #28

Open
tshort opened this issue Jan 15, 2015 · 3 comments
Open

Initial equations and initialization #28

tshort opened this issue Jan 15, 2015 · 3 comments

Comments

@tshort
Copy link
Owner

tshort commented Jan 15, 2015

Many problems currently fail during initialization. The initialization approaches in Sundials and DASSL are pretty simple. Lots has been written on the subject:

We can use KINSOL or NLSolve.jl to help. The main issue is that most models have underdetermined initial conditions, and KINSOL can't handle that. The methods outlined in the papers above might take a bit of work. It'd be nice to find something simple that's at least better than what we do now. The last paper above mentions turning the initial solution into an optimization problem. That might be something to try given that Julia has several good optimization packages.

@iraikov
Copy link
Collaborator

iraikov commented Jan 25, 2015

Kinsol should be able to find a solution if you give it a reasonable initial guess. By the way, does 'solve' update its input SimState with the solution it has found? If not, perhaps the API should be updated so that the solution found with solve can be passed to the main simulation procedures.

@tshort
Copy link
Owner Author

tshort commented Jan 25, 2015

I don't think solve does update, but it should. When I first tried Kinsol, I couldn't get it to solve underdetermined initial conditions.

@tshort
Copy link
Owner Author

tshort commented Jan 28, 2015

I'm going to leave this open for now. initialize! has been added, but has some limitations:

I've got a working initialize!. The issues are:

  • It only works for scalar Unknowns, not vectors.
  • It uses JuMP, and this increases load times. I tried using @require to make it optional, but I couldn't get it to work. Overall, I think this is okay. We'll have package caching sooner or later. JuMP is an uber-cool package.
  • It doesn't work after events, so if you have events in a model, you don't want to use sim(m, init = :none).

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

2 participants