Skip to content

scipy style bounds (replacement for list of lower and upper bounds)#6

Closed
arose13 wants to merge 1 commit into
eggzec:masterfrom
arose13:master
Closed

scipy style bounds (replacement for list of lower and upper bounds)#6
arose13 wants to merge 1 commit into
eggzec:masterfrom
arose13:master

Conversation

@arose13
Copy link
Copy Markdown

@arose13 arose13 commented Sep 20, 2016

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!

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@saudzahirr saudzahirr mentioned this pull request May 19, 2026
@saudzahirr
Copy link
Copy Markdown
Member

Closing as stale (opened 2016). This PR has merge conflicts against the current master. SciPy-style bounds support is still a welcome addition; please open a fresh PR rebased against the current master if you'd like to contribute it.

@saudzahirr saudzahirr closed this May 19, 2026
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>
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.

2 participants