简体   繁体   中英

Optaplanner for scheduling geometric shapes and area

I would like to use OptaPlanner to schedule tasks best represented as areas on a map. Basically, I have a set number of squares, and a number of circles with different priorities on a map, and I need to optimize position of the squares to intersect with the circles in such a way to optimize the priority score of circles intersected by squares.

My issue is in deciding which of the objects should be planning entities, and which should be problem facts. The OptaPlanner documentation here states that

In a many to one relationship, it is normally the many side that is the planning entity class. The property referencing the other side is then the planning variable. For example in employee rostering: the planning entity class is ShiftAssignment, not Employee, and the planning variable is ShiftAssignment.getEmployee() because one Employee has multiple ShiftAssignments but one ShiftAssignment has only one Employee.

This seems to indicate that Circle would be the planning entity, since many circles could be activated by a single Square. The planning variable would therefore be Circle.activatedBy(). However, later in the documentation, it states that

A planning entity is a JavaBean (POJO) that changes during solving.

The circles are fixed on the 2d plane--it is the squares themselves that are changing location. In addition, a circle could very well go unactivated if it is far from other circles, or is low enough priority. In those cases, Circle.activatedBy() would not return a specific square at all.

I've never used optaplanner before, so I'd appreciate an explanation of which to use and why. I'm also not quite sure how to begin representing the 2d plane all these objects even reside on, though I've been looking into GeoJSON and other solutions to determine if two polygons intersect. It could very well be that something like SquarePosition would be the best the planning entity, though I don't see how this is possible for OptaPlanner as there are an infinite number of potential positions for a polygon on a 2d plane.

My specific question is: In this case, would the Planning Entity annotation go on Square, and the Planning Variables be the X and Y coordinates of the Squares? If so, what would be the best way to approach creating moves for the Squares? In this case, each circle has a priority score, and if the square intersects a circle, it adds its score to the total score. I want to optimize for the highest score, so I was considering potentially having the square "orbit" around the highest priority circle to see what other circles it can possibly intersect with, then moving to the next priority circle and repeating. This doesn't sound optimal at all, though, and none of the otherwise fantastic OptaPlanner documentation covers these sorts of moves, as far as I can tell.

OptaPlanner 6.5 can't handle 2D surface or 3D volume packing elegantly yet. In a future version we will support it.

That being said, I did hack together a 3D volume packer using OptaPlanner a few years ago to handle 1m objects IIRC: Packing Santa's Sleigh (here be dragons) .

2D surface packing with polygons is bleeding edge research currently: look for the papers of the CODeS group, specifically those written by Tony Wauters.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM