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

BestSoFar... wanted behavior ? #41

Closed
thibmonsel opened this issue Feb 7, 2024 · 1 comment
Closed

BestSoFar... wanted behavior ? #41

thibmonsel opened this issue Feb 7, 2024 · 1 comment
Labels
question User queries

Comments

@thibmonsel
Copy link

Hi Patrick,

I suppose, that the BestSoFar... solvers are working as intended.

import jax.numpy as jnp
import optimistix as optx

def f(x, _):
    return 1 / 2 * x

solv = optx.FixedPointIteration(10e-3, 10e-3)
sol = optx.fixed_point(f, solv, jnp.array(0.3), max_steps=10)
print(sol.value)


solv2 = optx.BestSoFarFixedPoint(solv)
sol2 = optx.fixed_point(f, solv2, jnp.array(0.3), max_steps=3) # shoots out error
print(sol2.value) 

solv2 returns an XlaRuntimeError but could it be possible instead to return the best so far value computed (here it would be at max_steps=2) even if the latest value of sol2 doesn't satisfy there termination condition ?

If not, would there be a possibility to get the best so for value computed without throwing a runtime error ?

@patrick-kidger
Copy link
Owner

Yup -- pass fixed_point(..., throw=False).

@patrick-kidger patrick-kidger added the question User queries label Feb 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question User queries
Projects
None yet
Development

No branches or pull requests

2 participants