Skip to content

Use non-strict threshold when identifying candidate move areas#512

Open
hegen008 wants to merge 1 commit intopysal:mainfrom
hegen008:thresh_consistency
Open

Use non-strict threshold when identifying candidate move areas#512
hegen008 wants to merge 1 commit intopysal:mainfrom
hegen008:thresh_consistency

Conversation

@hegen008
Copy link
Copy Markdown

The max-p-regions problem uses a non-strict threshold, requiring that regions have a spatially extensive attribute greater than or equal to a predetermined threshold. This PR replaces > with >= in the pick_move_area() function to align with the non-strict threshold definition. With this improvement, when areas are identified as candidates to be moved in the simulated annealing phase, the remaining parts of the region are required to be >= the minimum region threshold, rather than strictly greater than it. The simulated annealing algorithm works with a strict threshold as originally written, but the results will generally not be as good with a lower number of potential move candidates identified. As this improvement affects the simulated annealing algorithm path, the expected result for 2 test cases needed to be updated as well.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.9%. Comparing base (9b36063) to head (77373ce).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main    #512   +/-   ##
=====================================
  Coverage   76.9%   76.9%           
=====================================
  Files         29      29           
  Lines       3700    3700           
=====================================
+ Hits        2846    2847    +1     
+ Misses       854     853    -1     
Files with missing lines Coverage Δ
spopt/region/maxp.py 98.4% <100.0%> (+0.4%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@knaaptime
Copy link
Copy Markdown
Member

thanks!

yeah, i think that's right, following the original JRS paper
Screenshot 2026-03-25 at 11 30 41 AM

i'll let @sjsrey weigh in to be absolutely sure though

@hegen008
Copy link
Copy Markdown
Author

Thanks for confirming that the problem definition has a non-strict threshold. To clarify to purpose of this PR, the algorithm is currently implemented with a non-strict threshold in most places, it is just this one line that uses a strict threshold instead. I think what is most important is that whichever is chosen is used consistently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants