Skip to main content

Empty Space Search (ESS)

PyPI - Version PyPI - Python Version GitHub License GitHub Actions Workflow Status GitHub last commit

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

  1. 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

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.

Metadata

Release files for EmptySpaceSearch 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for EmptySpaceSearch 0.2.1
File Size Uploaded Provenance Actions
emptyspacesearch-0.2.1.tar.gz 17.1 kB Without provenance Details for emptyspacesearch-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for EmptySpaceSearch 0.2.1
File Interpreter ABI Platform Actions
emptyspacesearch-0.2.1-py3-none-any.whl Python 3 none any Details for emptyspacesearch-0.2.1-py3-none-any.whl

Total release size: 34.0 kB

Release files / emptyspacesearch-0.2.1.tar.gz

Download URL emptyspacesearch-0.2.1.tar.gz
Size 17.1 kB
Tags Source
SHA-256 checksum
How to use checksums
fc30b7e24acbdf6f501ddc7e358da4f6a73adad4a33a97bf6505f9846ce193bb
BLAKE2b-256 checksum
How to use checksums
50d206d0e9c3063cc75c0be75035b28c1fc9dae64cac0c54e125a2947f8301c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / emptyspacesearch-0.2.1-py3-none-any.whl

Download URL emptyspacesearch-0.2.1-py3-none-any.whl
Size 16.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
931fa3ab3daa8145d7b64c39da2573b3a5e7d0791f5eba9e835e604bed270fc5
BLAKE2b-256 checksum
How to use checksums
38ba02d61ea4d03c957706bf91bdfb1e123080dfbf4e3c54bbe4414404c571cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Security for EmptySpaceSearch 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page