Skip to content

MILP trail search methods for one trail within a weight range - #492

Open
p-huynh wants to merge 1 commit into
developfrom
feat/add_milp_bounded_single_trail_search_methods
Open

MILP trail search methods for one trail within a weight range #492
p-huynh wants to merge 1 commit into
developfrom
feat/add_milp_bounded_single_trail_search_methods

Conversation

@p-huynh

@p-huynh p-huynh commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Currently, the MILP xor differential/linear models only allow the user to find one optimal trail or one trail with an exact weight. This PR adds two newfind_one_xor_*_trail_with_weight_at_most methods:

  • They take an upper bound (and optionally a lower bound), and return a trail whose weight falls within the range [0..upper_bound] (or [lower_boud..upper_bound]), mirroring the existing find_all_*_trails_with_weight_at_most methods.
  • The old existing fixed weight methods now just call these with the lower and upper bound set to the same value.

Additional cleanup:

  • Simplified weight_constraints, and removed an old unused trick where a negative weight quietly meant "at most". It only existed in the MILP model and nothing used it.
  • Rewrote find_all_..._with_weight_at_most to add a single range constraint and collect the trails in one pass, instead of looping over every weight value. It returns the same trails, with fewer solver calls.

@sonarqubecloud

sonarqubecloud Bot commented Aug 6, 2026

Copy link
Copy Markdown

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

Successfully merging this pull request may close these issues.

1 participant