scipy style bounds (replacement for list of lower and upper bounds)#6
Closed
arose13 wants to merge 1 commit into
Closed
scipy style bounds (replacement for list of lower and upper bounds)#6arose13 wants to merge 1 commit into
arose13 wants to merge 1 commit into
Conversation
|
Closed
Member
|
Closing as stale (opened 2016). This PR has merge conflicts against the current |
4 tasks
saudzahirr
added a commit
that referenced
this pull request
May 19, 2026
* fix: gate stopping messages on debug; add patience for plateau convergence All stopping-search print statements now respect the debug flag so that debug=False (the default) produces no output at all (closes #20). A new patience parameter (default 0, meaning disabled) counts consecutive iterations without improvement and stops the search when that count reaches patience. This lets callers avoid needless iterations when the swarm has converged to an exact optimum where fp[i_min] == fg indefinitely (closes #22). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat: add scipy-style bounds parameter Accept bounds as a list of (lo, hi) pairs in addition to the existing separate lb and ub arrays, matching the convention used by scipy.optimize. When bounds is provided it takes precedence; lb and ub may be omitted. Fully backwards-compatible — existing callers using lb/ub are unaffected. Closes #5, closes #6. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat: add pool parameter; fix multiprocessing pool resource leak Callers can now pass any object with a map() method (multiprocessing.Pool, ipyparallel, dask, etc.) via the pool keyword argument. When pool is given, processes is ignored and the caller manages the pool lifecycle. When the library creates its own pool (processes > 1, pool=None) it now correctly terminates and joins it via try/finally, fixing the silent resource leak in the original implementation where the pool was never closed. Closes #12, closes #16. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat: add init parameter for custom initial particle positions Users can now seed the swarm with known good starting points by passing an (swarmsize × ndim) array via the init keyword argument. This is useful for warm-starting from a previous run or for incorporating domain knowledge about where good solutions are likely to lie. Out-of-bounds values are silently clipped to [lb, ub]. Closes #21. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat: add intvar parameter for integer design variables Pass a list of dimension indices via intvar to constrain those variables to integer values. After each position update (and on initial placement) the selected dimensions are rounded to the nearest integer and clipped to [lb, ub]. This enables mixed-integer PSO without changing the continuous variables. Closes #14, closes #17. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Other folks might have automated pipelines like me where having parameters that take SciPy like inputs (the bounds in particular) would be better that specifying the lower and upper bounds. It also makes the code more readable in my opinion.
Love the project, cheers mate!