8 Commits

Author SHA1 Message Date
Raffson
6ae32b13b8
Format missed files with black 2024-10-12 17:50:54 +02:00
Raffson
377d0a2fad
mypy fix 2024-04-13 19:52:38 +02:00
Raffson
d8ce0a6c24
Revert "Fix mypy complaint"
This reverts commit b0047784dc7b5fde70b6d27da6ca9c3e2fd5428b.
2023-10-15 20:56:30 +02:00
Raffson
b0047784dc
Fix mypy complaint 2023-10-15 20:03:17 +02:00
Raffson
c50dcaaafb
Streamlining 2023-10-07 18:00:07 +02:00
Dan Albert
d96f7a267c
Add test cases found by fuzzer. 2023-10-07 17:07:33 +02:00
Dan Albert
98f92f9ab2
Add fuzz testing for waypoint solvers.
This fuzz test generates random inputs for waypoint solvers to check if
they can find a solution. If they can't, the debug info for the solver
is dumped to the testcases directory. Another test loads those test
cases, creates a solver from them, and checks that a solution is found.
Obviously it won't be immediately, but it's a starting point for fixing
the bug and serves as a regression test afterward.
2023-10-07 17:07:33 +02:00
Dan Albert
643dafd2c8
Build common interface for waypoint geometry constraints.
This is a replacement for the existing "zone geometry" classes that are
currently used for choosing locations for IP, hold, and join points.
The older approach required the author to define the methods for
choosing locations at a rather low level using shapely APIs to merge or
mask geometries. Debug UIs had to be defined manually which was a great
deal of work. Worse, those debug UIs were only useable for *successful*
waypoint placement. If there was a bug in the solver (which was pretty
much unavoidable during development or tuning), it wasn't possible to
use the debug UI.

This new system adds a (very simple) geometric constraint solver to
allow the author to describe the requirements for a waypoint at a high
level. Each waypoint type will define a waypoint solver that defines one
or more waypoint strategies which will be tried in order. For example,
the IP solver might have the following strategies:

1. Safe IP
2. Threat tolerant IP
3. Unsafe IP
4. Safe backtracking IP
5. Unsafe backtracking IP

We prefer those in the order defined, but the preferred strategies won't
always have a valid solution. When that happens, the next one is tried.

The strategies define the constraints for the waypoint location. For
example, the safe IP strategy could be defined as (in pseudo code):

* At least 5 NM away from the departure airfield
* Not farther from the departure airfield than the target is
* Within 10 NM and 45 NM of the target (doctrine dependent)
* Safe
* Within the permissible region, select the point nearest the departure
  airfield

When a solver fails to find a solution using any strategy, debug
information is automatically written in a GeoJSON format which can be
viewed on geojson.io.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/3085.
2023-10-07 17:07:21 +02:00