Add boundary handlers for stuck particles
See original GitHub issueIs your feature request related to a problem? Please describe.
There are some stuck particles as reported in #234 and #150 . This is related to compute_position
waiving position updates whenever a particle will potentially end up out-of-bounds. There are standard ways to avoid this problem. The reflective bounds is one option, but the related PR is currently stale, so it may be important to create a general framework for handling the boundary problem.
Describe the solution you’d like
Create a set of handlers, such as a BoundaryHandler
. Usage example:
Usage outside of the class
# Usage outside of the class
from pyswarms.backend import operators as ops
from pyswarms.backend.handlers import BoundaryHandler
bh = BoundaryHandler(strategy="reflective") # And other arguments here if it's parameterized
ops.compute_position(swarm, bounds, handler=bh)
Inside BoundaryHandler
# Inside BoundaryHandler
class BoundaryHandler(object):
def __call__(self, position, bounds, *args, **kwargs): # parameterized
# Some logic here depending on the type of handler, for example:
# (might be better as a dictionary with a string as key and callable as
# its value)
if self.strategy == "reflective":
new_positions = self.reflective(position, bounds) # parameterized
def reflective(self, position, bounds):
"""Some docstring here"""
pass
How it will work in the backend:
if handler:
new_position = handler(swarm.positions, bounds)
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Boundary Handling and Adaptive Time-stepping for PCISPH
We present a novel boundary handling scheme for incompressible fluids based on Smoothed Particle Hydrodynamics (SPH).
Read more >A generic smoothed wall boundary in multi-resolution ...
One of the challenges for wall boundary models is how to deal with moving or deforming complex geometry boundaries. For the boundary models ......
Read more >Analyzing particles on a stick boundary using ...
In this week's blog post we will investigate Lagrangian post-processing and more specifically the function of boundary sampling.
Read more >Liquid Boundaries for Implicit Incompressible SPH
fluid and boundary representation adds flexibility to IISPH which enables versatile effects. In particular, particles can now dynami-.
Read more >Moving Least Squares Boundaries for SPH Fluids
The paper shows that the SPH boundary handling of Akinci et al. [AIA ... Particle-based boundary representations in fluid simulations are.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes! I have never done that, might be a nice experience 😄
I wonder if it might suffice to use a VelocityHandler. If the particles don’t even leave the bounds there is no reason to fix the position 🤔 Maybe we can try it out like that?
Ok 👍 Let’s do this one!