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

Allocation should return same strategy if a model is run twice #1709

Open
3 tasks
Jingru923 opened this issue Aug 9, 2024 · 3 comments
Open
3 tasks

Allocation should return same strategy if a model is run twice #1709

Jingru923 opened this issue Aug 9, 2024 · 3 comments
Labels
allocation Allocation layer improvement Improvements of the usability of existing functionality

Comments

@Jingru923
Copy link
Contributor

What
When building up benchmark for Ribasim, it has come to attention that if I run a model with allocation twice, I will get different water balance. This is because some optimization problems have unlimited solutions and the solver returns a random one. Therefore the output of allocation model is always different. This should be investigated.

How

  • Investigate JuMP and its solvers. Given an optimization problem with non-unique solution, the solver should return the same solution every time.
  • Run model with allocation twice, and see if the output is the same
  • Update the benchmark for allocation models.
@Jingru923 Jingru923 added allocation Allocation layer improvement Improvements of the usability of existing functionality labels Aug 9, 2024
@Jingru923
Copy link
Contributor Author

Jingru923 commented Aug 9, 2024

In the regression_test.jl, these tests should be added to the testitem for regression_ode_solvers_allocation.

                # TODO @test all(q -> abs(q) < 12.0, basin.storage - basin_bench.storage)
                # TODO @test all(
                #     q -> abs(q) < 100.0,
                #     basin.storage[(end - 16):end] - basin_bench.storage[(end - 16):end],
                # )
                # TODO @test all(
                #     q -> abs(q) < 2.0,
                #     basin.level[(end - 16):end] - basin_bench.level[(end - 16):end],
                # )
                # TODO @test all(q -> abs(q) < 1e-1, basin.balance_error)
                # TODO @test all(q -> abs(q) < 30.0, basin.relative_error)

@Huite
Copy link
Contributor

Huite commented Aug 9, 2024

Given an optimization problem with non-unique solution, the solver should return the same solution every time

Wouldn't it be better to make sure you have a unique solution? I.e. we should make it so that the optimization problem is well defined?

@SouthEndMusic
Copy link
Collaborator

Yes, that's what upcoming issues for allocation are for, especially optimizing per source individually. Still, it's weird that the optimizer is not deterministic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
allocation Allocation layer improvement Improvements of the usability of existing functionality
Projects
Status: To do
Development

No branches or pull requests

3 participants