Empty Space Search
Project description
Empty Space Search (ESS)
ESS is a high-performance Python library that implements the Electrostatic Search Algorithm (ESA), a novel method for generating spatially diverse point distributions. It simulates electrostatic repulsive forces to "relax" new points into the empty spaces of a high-dimensional domain, making it ideal for sampling, coverage optimization, and exploratory data analysis.
Features
- Electrostatic Search Algorithm (ESA): Uses physics-inspired repulsive forces (Gaussian, Softened Inverse, etc.) to maximize the separation between points.
- Scalable Batch Processing: Optimized to handle large datasets by processing new points in efficient batches, preventing memory overload and "clumping" artifacts.
- Dual NN Architecture:
- NumpyNN: A pure NumPy implementation optimized for vectorization, ideal for small-to-medium datasets (< 5,000 points) and systems where external C++ dependencies are undesirable.
- FaissNN: A high-performance implementation using Faiss (CPU-only) for scaling to larger datasets.
- High-Dimensional Metrics: Includes robust coverage metrics (Maximin, Clark-Evans Index, Sparse Grid Coverage) that work effectively even in high-dimensional spaces (> 32D).
- Smart Initialization: Uses a "Best Candidate" sampling strategy to seed new batches in the most promising void regions before optimization begins.
Note: The library is designed to be compliant with modern Python 3.12+ standards.
Installation
The library can be installed directly from GitHub by adding the following line to your requirements.txt file:
git+[https://github.com/mariolpantunes/ess@main#egg=ess](https://github.com/mariolpantunes/ess@main#egg=ess)
Requirements:
- Python >= 3.12
- numpy
- faiss-cpu
Usage
Basic Example
Generate 100 new points in a 2D space [0, 1] x [0, 1] using the default settings:
import numpy as np
import ess.ess as ess
# Define existing points (e.g., obstacles)
obstacles = np.array([[0.5, 0.5]])
bounds = np.array([[0, 1], [0, 1]])
# Generate 100 new points
# If nn_instance is None, it defaults to NumpyNN
result = ess.ess(obstacles, bounds, n=100, seed=42)
print(f"Total points: {len(result)}")
Advanced Usage with Faiss
For larger datasets, explicitly use the FaissNN backend:
from ess.ess import ess
from ess.nn import FaissNN
import numpy as np
# 1000 existing points in 50 dimensions
dim = 50
obstacles = np.random.rand(1000, dim)
bounds = np.array([[0, 1]] * dim)
# Initialize FaissNN
nn_engine = FaissNN(dimension=dim, seed=42)
# Run ESS with batching
new_points = ess(
obstacles,
bounds,
n=500,
nn_instance=nn_engine,
batch_size=100,
epochs=256
)
Algorithms
- ESA (Electrostatic Search Algorithm): The core algorithm. It treats existing points as fixed charged particles and new points as free moving charges. The new points are iteratively pushed away from neighbors until they settle in the "valleys" of the potential field (the empty spaces).
- Forces Available:
gaussian: Smooth, short-range repulsion (default).softened_inverse: Strong near-field repulsion, computationally cheaper.linear: Simple linear drop-off within a radius.cauchy: Heavy-tailed distribution.
Documentation
This library is documented using Google-style docstrings.
To generate the documentation locally using pdoc, run the following command:
pdoc --math -d google -o docs src/ess
Authors
- Mário Antunes - mariolpantunes
License
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2025 Mário Antunes
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file emptyspacesearch-0.2.1.tar.gz.
File metadata
- Download URL: emptyspacesearch-0.2.1.tar.gz
- Upload date:
- Size: 17.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc30b7e24acbdf6f501ddc7e358da4f6a73adad4a33a97bf6505f9846ce193bb
|
|
| MD5 |
897dbe11f297033c6c729dbb27f4c365
|
|
| BLAKE2b-256 |
50d206d0e9c3063cc75c0be75035b28c1fc9dae64cac0c54e125a2947f8301c3
|
File details
Details for the file emptyspacesearch-0.2.1-py3-none-any.whl.
File metadata
- Download URL: emptyspacesearch-0.2.1-py3-none-any.whl
- Upload date:
- Size: 16.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
931fa3ab3daa8145d7b64c39da2573b3a5e7d0791f5eba9e835e604bed270fc5
|
|
| MD5 |
9210b9331a51451e14e4a2a6f4fffda2
|
|
| BLAKE2b-256 |
38ba02d61ea4d03c957706bf91bdfb1e123080dfbf4e3c54bbe4414404c571cf
|