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

LeapHybridNLSampler not rejecting for state_size() > maximum_number_of_states #526

Open
JoelPasvolsky opened this issue Jul 18, 2024 · 1 comment

Comments

@JoelPasvolsky
Copy link
Contributor

Description
LeapHybridNLSampler accepts models with more than maximum_number_of_states states initialized but quietly ignore the rest. Users might think the rest are being used.

To Reproduce

model = traveling_salesperson(distance_matrix=DISTANCE_MATRIX)
route, = model.iter_decisions()
with model.lock():
    model.states.resize(2)
     route.set_state(0, [0, 1, 2, 3, 4])
    route.set_state(1, [0, 1, 2, 3, 4])
results = sampler.sample(
     model,
     label='SDK Examples - TSP')

Expected it to reject: "Alex C 6 days ago Something that came up... we need to add it. And reject problems based on that num_states field in the header"

Expected behavior
Reject such problems

Environment:

  • OS: WIN
  • Python version: 3.11

Additional context
@alexzucca90 suggested to move to here.
I notice we actually check maximum_number_of_states property here so can easily do this in the client.

@randomir
Copy link
Member

We could also just raise a user warning and continue with the truncated states. Seems more user friendly (but less explicit), unless you think it's really important for users to realize only one state is used (currently).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants