GithubHelp home page GithubHelp logo

Agent collisions about mesa-geo HOT 3 CLOSED

projectmesa avatar projectmesa commented on May 26, 2024
Agent collisions

from mesa-geo.

Comments (3)

wang-boyu avatar wang-boyu commented on May 26, 2024

This would be a useful feature for certain cases, and involve a physics engine in order to do collision detection. Looks like similar functionalities have been added into MASON (a Java ABM library) as an extension:

For us, there should be several 2d physics engines available in Python. I'm wondering whether it makes more sense to have it as a separate Mesa extension, like the case for MASON.

from mesa-geo.

rht avatar rht commented on May 26, 2024

For us, there should be several 2d physics engines available in Python.

Yeah, there should be some that already exist.

from mesa-geo.

wang-boyu avatar wang-boyu commented on May 26, 2024

As a workaround, we can randomly assign agents' location to avoid them standing on top of each other. These are demonstrated in some example models in this repo:

raster data model
In the Population model, to assign random positions to people within the same raster cell:

def set_random_world_coord(self):
world_coord_point = Point(
self.model.space.population_layer.transform * self.img_coord
)
random_world_coord_x = world_coord_point.x + np.random.uniform(
-self.MOBILITY_RANGE_X, self.MOBILITY_RANGE_X
)
random_world_coord_y = world_coord_point.y + np.random.uniform(
-self.MOBILITY_RANGE_Y, self.MOBILITY_RANGE_Y
)
self.geometry = Point(random_world_coord_x, random_world_coord_y)

vector data model
In the GeoSchelling (Points & Polygons) model, to assign random positions to people within the same polygon:

def add_person_to_region(self, person, region_id):
person.region_id = region_id
person.geometry = self._id_region_map[region_id].random_point()
self._id_region_map[region_id].add_person(person)
super().add_agents(person)
self.num_people += 1

As mentioned above, physics engines won't be implemented within mesa-geo for now. Hence I'm closing this issue as won't fix. But pls feel free to continue the discussion here. We can also convert this to a discussion if needed.

from mesa-geo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.