Comments (79)
You need to edit scoring-rules.config.js
and add a scoring rule with a closingDistanceFixed: 0.4
from igc-xc-score.
I added the change to the scoring rules here:
https://github.com/hyperknot/igc-xc-score/blob/6bca0fe83ed608a09261b2eb8eab982f4ce5e167/scoring-rules.config.js#L124
My problem is that it's not doing the optimal calculation. The best point would not be on the track, but between the "head" and the "tail" of the tracklog, as illustrated here. Do you think you can modify the app to make such calculations?
Are FFVL and XContest calculating the closing differently? Also, what is the difference between code: fai
and tri
?
from igc-xc-score.
An fai
triangle must be almost equilateral with none of its sides being smaller than 28% of the total perimeter.
Do you have a link to a document explaining those rules? Normally all points must lie on the track.
from igc-xc-score.
Sure, it's here: https://www.fai.org/sites/default/files/civl/documents/sporting_code_s7_d_-_records_and_badges_2022.pdf
It's not an easy read, but I believe it's like on my drawing:
from igc-xc-score.
Ok, so in fact all turnpoints and the start/finish points are 400m cylinders?
from igc-xc-score.
Yes. But for the turnpoints it makes no sense to make them cylinders, it's easier to calculate them as points. The trick is the start/end cylinder.
from igc-xc-score.
In fact this rule can be interpreted as a 800m closing rule? It is a bijection:
- All points that a separated by 800m or less can be inside a 400m radius cylinder
- No points separated by more than 800m can be inside a 400m radius cylinder
from igc-xc-score.
I think a straight 800 meter line is not optimal. The optimal solution would be a "buffer" operation around both polylines and then finding the furthest point on this polygon.
from igc-xc-score.
I think that it is. You think that a 800m rule will leave out points that will be included in the buffers? I don't see any case where this is possible?
from igc-xc-score.
It's very close to optimal but not optimal. I don't know how much we want to optimise those few meters though. I made a Geogebra sketch. The left point is the 800 meter midpoint, the right point is the optimal one.
A very simple algorithm I could imagine is:
- Calculate the start/endpoint as it does currently.
- In a loop: Move the start/end 1 meter in a random direction, check if still FAI and still within 400 meter of both. If yes and score is bigger than the previous one, move it.
from igc-xc-score.
2r
is a better closing then the angled r+r
- it keeps more of the track
from igc-xc-score.
It's true but FAI calculates by the triangle sides, which in our case is determined by the center of the circle.
from igc-xc-score.
Do you mean the turnpoints or the closing? The placement of the closing center does not influence the score, only the part of the track that is included or not influences the score. But this is not true for the turnpoints, this was my first question?
from igc-xc-score.
The FAI document is really quite low in details, but here is how I understand it:
- You put 3 circles, such that they are 400 meter radius and they include 1-1-2 points of the track.
- You select the closest point of each circle to make up the triangle.
- For the 2 mid-points, this basically makes no sense, you select a point, put a circle and then select the original point again. Instead it makes sense to select the track point itself.
- For the start/end point, now I believe it'd be point K on this updated sketch:
from igc-xc-score.
All FAI rules use 400m cylinders. This means that if you are following a predefined task, you must cross into the 400m cylinder for the turnpoint to be considered attained.
When scoring a free triangle - which means that you define the best possible task given your existing flight track - it is in your best interest to define the turnpoint 400m away from the actual triangle vertex. This rule will require some adapting of igc-xc-score
.
The closing is defined as a single point that must be not further than 400m from each side of the track. This rule should be perfectly satisfied by using 800m as closing distance.
I wonder if there is some clever way to calculate the size of the biggest triangle that has vertices lying on equal circles around the given triangle - there probably is - as this will be much easier to implement.
from igc-xc-score.
I am positive that these are similar triangles but I do not see any easy proof
The inside triangle is the actual triangle on the flight track. The outside triangle is the biggest triangle that fits if its vertices lie on the 400m circles of the inside triangle vertices.
from igc-xc-score.
In the FAI rules, every time they calculate using the center of a cylinder (in declared records), you always have to subtract 2 * 400 meters for that cylinder. With straight or straight-with-3-points free distance records, you don't use cylinders, thus you don't need to subtract 2*400 meters for them.
Now for this case, it's really not clear. I'd believe that we cannot cheat, thus if we don't subtract then we have to take the closest points of those circles. (This is the reason why I wrote that for the 2 mid-points it doesn't make any sense to add a circle and then select the original point in the next step).
I'll ask them about clarification, it makes no sense to develop the wrong method :-)
from igc-xc-score.
Do you have any examples of scored flights?
from igc-xc-score.
Unfortunately here they don't provide any details: https://www.fai.org/records?f%5B0%5D=field_record_sport%3A2026&f%5B1%5D=field_record_category%3A125&f%5B2%5D=field_subclass%3A231&f%5B3%5D=field_type_of_record%3A330
I wrote them an email asking for clarifications.
from igc-xc-score.
I got an answer from FAI:
5.2.5. Validation Using Start, Turn or Finish Cylinders
The record or badge distance shall be calculated as the minimum distance it is possible to fly by entering the cylinder observation zones. See 1.5.13.3.1. The minimum distance is defined as the straight-line distance between each pair of turn points, decreased by 800 meters for each turn point and 400 meters for each Start/Finish point.
So I believe we can put these circles wherever we want, the calculation is through the centers - 3 * 800 meters.
from igc-xc-score.
The way I understand this is that the current scoring method is the right one - because it measures the triangle from the points on the flight track - which are 400m away from the turnpoint - however the placement of the turnpoints is not - because they must be further away. But I don't understand the significance of the 400m for the Start/Finish point since the placement of the Start/Finish point is not supposed to have any effect on the score - except for yes/no validity of the triangle. Can you find at least one example of a scored triangle flight?
from igc-xc-score.
The writing "400 meters for each Start/Finish point." I believe is from the straight distance flights, where the points are different. In our case they are the same and it's 800 meters.
I'll ask them if they can share a scored triangle flight, it's not published on the website.
Now I think we need to optimise all 3 points, as the record is calculated by the center points. I don't think it makes sense but the rules say this so we have no choice.
from igc-xc-score.
If this is indeed the case, I think this may be done without modifying the underlying search algorithm - once the inner triangle is found, the outer one can be directly computed.
from igc-xc-score.
I think for the mid-points we can do that, yes. For the start/endpoint I have no other idea but to make a one-off gradient descent-like algorithm.
FAI replied that they use SeeYou, which optimises the distances totally bad. So it's good to know that there is no software which can actually optimise for what FAI is writing in Section 7D. If we can modify igc-xc-score it'd be the first software to do this correctly.
from igc-xc-score.
I don't think there is anything to do for the start finish point? It does not participate in the score at all - it is only about validity - yes/no.
Those triangles can be calculated from their medians - the medians of the outer triangle are exactly the medians of the inner triangle + 400m.
This means that:
Ma = sqrt(2 * AC**2 + 2*AB**2 - BC**2)
Md = sqrt(2 * DF**2 + 2*DE**2 - EF**2) = sqrt(2 * AC**2 + 2*AB**2 - BC**2) + 400m
for each median
from igc-xc-score.
I think I just figured it out. Basically igc-xc-score is doing everything perfect as it is now, with closingDistanceFixed: 0.8
.
The drawing in Section 7D about the triangle are wrong.
Free distance around a triangle:
• a closed course flight via 3 position checkpoints, independent of the position of the start/finish
point. The official distance is given by the sum of the legs of the triangle formed by the position
checkpoints.
Basically the question is if the "Mercedes star" type FAI triangles are allowed or not. I really believe they are, and this simplifies our calculation a lot!
Here is an example current world record which is a "Mercedes star" like:
https://www.xcontest.org/2019/world/en/flights/detail:brigitte.kurbel/24.06.2019/07:01
and the record: https://www.fai.org/record/18974
igc-xc-score calculates 269.12 km, the FAI record was 269.13 km.
So we have 5 points to optimise: TP1, TP2, TP3, start (cp_in), end (cp_out), which is working perfectly in the current version.
from igc-xc-score.
I just did run this IGC and my results are 269.12 when using Vincenty's method (hp=true
) and 269.13 - the same as the FAI record - when using the much faster approximative formula known as the US FTC method (it was first published by the US FTC in some document about measuring distance between radio emitters and it is famous for being mistaken in the first edition).
I think that it is up to the FAI to clarify this situation.
Their official document states that distances are to be measured according the WGS84 ellipsoid. However (there is a very length explanation about this in the project's README), there is no analytical method for calculating this distance. There is the FTC approximation and there is the iterative Vincenty's method which can be repeated as many times as it is needed to obtain arbitrary precision - igc-xc-score stops at 60cm.
Most practical applications use the FTC method which is much faster since normally a distance of 10m won't matter that much over 270km - but since this is a world record, there should probably be a very strict official method for measuring it.
Also, when it comes to scoring the flight, there is one more point that I forgot about - the closingDistanceFree
parameter - because according to some governing bodies, the closing distance is to be substracted from the total distance, while for others (the French FFVL), there is a free (3km) closing distance that does not incur a penalty at all. I am sorry, but I totally forgot about this.
from igc-xc-score.
I think for the measurement it has to be Vincenty, that is the reference calculation for geographic distances. FAI currently uses SeeYou which from my experimenting produces the least precise calculation, GPSDump does a much more precise one for example.
For closingDistanceFree
in our case it's equal to closingDistanceFixed
, as the 800 meter is not subtracted at the end.
BTW from what I've seen on the cli, it seems like the distance value is not subtracted (in km), but the point is subtracted (when using 1.0 scoring). So if I looked at the distance value it's the same with or without closingDistanceFree
, is that right?
from igc-xc-score.
Not strictly this ticket, but related: this flight gets calculated as 141 km in igc-xc-score (XContest profile) and 138 km in XContest. Do you know what could be the reason? Better optimisation or some rules are wrong?
https://www.xcontest.org/world/en/flights/detail:szabbbolcs/27.6.2022/09:20
from igc-xc-score.
I am sorry for the late reply, but I was exceptionally busy.
The two programs produce a nearly identical scoring: 220.88 for XContest and 221.15 for igc-xc-score.
The 3km difference comes from the fact that igc-xc-score displays the total distance of the triangle and the penalty for the closing distance while XContest displays the total distance of the triangle minus the penalty.
The 200m difference comes from the higher resolution used by igc-xc-score - the XContest scoring has simplified the line, eliminating some points. igc-xc-score considers every point coming from the GPS.
from igc-xc-score.
Thanks for the explanation, so that part is by design.
Now, a much more important question, is it possible to implement out-and-return distance as per FAI definition?
Free out and return distance: a closed course flight having one position checkpoint.
This is similar to "tri", or "flat-triangles", but FAI has a very different definition which makes it a totally different scoring.
Basically it only needs TP1, cp_in, cp_out with closingDistanceFixed: 0.8. I guess it could be a much simplified case of the tri code.
from igc-xc-score.
Yes, this is a very simple type of flight with only point that needs searching, I will probably have more time to work on this August.
from igc-xc-score.
@hyperknot do you have any examples of flights and their score following this new scoring type?
from igc-xc-score.
@hyperknot do you have any examples of flights and their score following this new scoring type?
The current world record:
https://www.xcontest.org/2018/world/en/flights/detail:primozs/21.04.2018/06:52
FAI link: https://www.fai.org/record/18462
What you cannot test on this one is how the "unscored leg" is handled, as obviously world record holders make perfectly planned flights. I mean that the normal flat triangle allows you to make a "bonus leg" at the very end, like on a triangle, but on this distance it is not possible. The start point has to be before the first turn point.
from igc-xc-score.
In fact, this type of flight has only cp_in
which is also cp_out
(with a fixed closing distance of 800m) and TP1
?
from igc-xc-score.
Yes, I believe:
takeoff - cp_in - TP1 - cp_out (d=800) - landing
from igc-xc-score.
There can be two turnpoints - since you can launch, fly to point 1, then fly to point 2, then fly back to close. Here is a very good example: https://www.xcleague.com/xc/info/rulesflights-circuit.html
from igc-xc-score.
I get 303.35km on this flight when using Vincenty's
from igc-xc-score.
There can be two turnpoints - since you can launch, fly to point 1, then fly to point 2, then fly back to close. Here is a very good example: https://www.xcleague.com/xc/info/rulesflights-circuit.html
No, this is where FAI differs from anyone else:
It doesn't make any sense for me, but they define it as having only one turnpoint.
from igc-xc-score.
Ok, I implemented it with 2 TPs, I will do both variants
https://github.com/mmomtchev/igc-xc-score/tree/oar
(by the way, off-topic, was the Enzo 3 available in 2018??)
from igc-xc-score.
Thanks, that looks great! I recommend changing all the multipliers to 1.0 to make it easier to get some information out of it, used for scoring.
Enzo 3 came out in 2017, unbelievable!
from igc-xc-score.
301,94km with the FAI rules
from igc-xc-score.
Do you have a close up screenshot or GeoJSON? I'd be curious to see how does it handle the closing?
from igc-xc-score.
@hyperknot Alas, I am missing one optimization that requires me to really rework the closing - in this type of closing, it is in your best interest to move away the closing as much as you can - and to calculate the distance with the far end - and this is currently remarkably slow
from igc-xc-score.
But this looks like perfect, isn't it? Do you mean it's not yet optimised perfectly?
from igc-xc-score.
The funny thing is that for this scoring type, a simple brute-force approach would work really well.
from igc-xc-score.
Yes, but this would require rewriting everything from scratch for this type of flight 😄
I am still trying to find an elegant way to do this with the current architecture
from igc-xc-score.
I added both definitions, but I took a shortcut that doesn't work if you allow for closing with a penalty - as the FAI Rules do not
https://github.com/mmomtchev/igc-xc-score/tree/oar
Now that I have some XCLeague rules I will probably add the rest and then the biggest problems is that this needs lots of testing before release
When I did the FFVL and XContest rules I simply downloaded the IGCs from their websites, then ran my scoring and searched for any suspicious differences
from igc-xc-score.
Looks good to me. The only problem I see is how do I specify the way I'd like to score a given flight? I mean I definitely want to score a flight based on or1
for example, even if it'd give higher points as a triangle.
The only workaround I could come up with was to make a separate category for each flight kind under FAI. So instead of "FAI" group, I'd have "FAI_OR1" with only one rule in there. I think a better solution would be an option to specify the rule being used.
from igc-xc-score.
This would come down to the same - currently you can group rules and leave the scoring program select the highest scoring rule in each group
from igc-xc-score.
Yes, that is the problem with the current approach. When scoring record flights, you know exactly what rule you'd like to use.
from igc-xc-score.
@hyperknot I can move all FAI rules to their own categories? AFAIK, FAI does not have scoring multipliers at all?
I merged this branch
Can you please check the results of what I have done - there won't be many beta testers before release
from igc-xc-score.
You could also use your input for #128 which should probably be solved before releasing 1.7.0
from igc-xc-score.
@hyperknot After going once again very carefully through the FAI sporting code, section 5.2.5:
https://www.fai.org/sites/default/files/civl/documents/sporting_code_s7_d_-_records_and_badges_2022.pdf
I concluded that when closing an out-and-return distance to one turnpoint, the actual point used must lie on the middle of the 800m closing line - not on the best end. Can you confirm this?
Only the FAI OaR is concerned by this rule - this is the only type of flight where the exact position of the closing line matters.
from igc-xc-score.
@hyperknot I implemented the cylinders, but alas, I don't have any ideal solution for Free distance around 3 TPs - I will continue trying, but I am afraid that the current approach cannot be applied to those flights when they are scored using cylinders...
from igc-xc-score.
@hyperknot I have implemented what I think is the perfect scoring according to all FAI rules in the sporting code, section 7D.
I have focused on obtaining a perfect result, and unless there is a bug, this should be the case.
I haven't implemented all time-saving optimizations and currently FAI scoring is very slow. I will release a beta1
in the current state as I cannot afford to invest any more time in this.
If you can test and confirm that everything works as expected, I will proceed with the final release.
from igc-xc-score.
@mmomtchev this sounds great, thanks a lot for the huge effort! I'll need time to properly test these things, I'll try to look at them in detail over the weekend.
from igc-xc-score.
@mmomtchev I'm looking at it now, trying to score this flight as FAI out-and-return.
https://www.xcontest.org/2022/world/en/flights/detail:justACRO/14.8.2022/08:47
What is the difference between OAR1 and 2 (and boundOutAndReturn, scoreOutAndReturn)?
from igc-xc-score.
I get
Cannot read properties of undefined (reading 'value')
for oar2.
from igc-xc-score.
I think it works perfectly! OAR1:
from igc-xc-score.
I think it should be on the track. Basically it's totally not clear from FAI, but I recommend going with on track TP0 and let's see what FAI answers after the next plenary meeting.
from igc-xc-score.
I get
Cannot read properties of undefined (reading 'value')
for oar2.
Can you post the config file you used? OAR2 is the XCLeague definition of an out-and-return distance flight - which is equivalent to the 2 turnpoints FAI flight.
from igc-xc-score.
I think it should be on the track. Basically it's totally not clear from FAI, but I recommend going with on track TP0 and let's see what FAI answers after the next plenary meeting.
You can simply remove cylinders: 0.4
from this rule - and performance will be back to what it was before
from igc-xc-score.
I get
Cannot read properties of undefined (reading 'value')
for oar2.
Can you post the config file you used? OAR2 is the XCLeague definition of an out-and-return distance flight - which is equivalent to the 2 turnpoints FAI flight.
I used FAI-OAR2
in cli.js:
igc-xc-score/scoring-rules.config.js
Line 196 in d3ff50c
from igc-xc-score.
You can simply remove
cylinders: 0.4
from this rule - and performance will be back to what it was before
Thanks, that's it. I think with that it's perfect!
from igc-xc-score.
Actually there is a possible bug:
- setting cylinders: 0 works perfect and quick
- removing the cylinders key on the other hand triggers some kind of infinite-loop, where the bound is already smaller then the final distance and gets lower and lower
from igc-xc-score.
Sorry, my bad, if you are removing cylinders
you should also remove post: scoring.adjustFAICylinders
from igc-xc-score.
Clear. I think we can settle on FAI-OAR like this:
'FAI-OAR': [
{
/**
* This is the FAI definition of Out-and-Return Distance
* with a single TP
*/
name: 'Out-and-Return Distance',
multiplier: 1,
bound: scoring.boundOutAndReturn1,
score: scoring.scoreOutAndReturn1,
closingDistance: scoring.closingWithLimit,
closingDistanceFree: 0.8,
closingDistanceFixed: 0.8,
rounding: round2,
finalRounding: round1,
cardinality: 3,
code: 'oar',
}
],
One question: what does the (400m) in the bracket mean? I guess it's the non-subtracted closing distance, but it's a bit confusing in those lines:
TP1 : TP2 : 103.73km (0.400km)
TP2 : TP1 : 103.73km (0.400km)
from igc-xc-score.
@hyperknot, what about the cylinders for the triangles?
from igc-xc-score.
@hyperknot, what about the cylinders for the triangles?
I believe this should be it:
'FAI-Tri': [
{
name: 'FAI Triangle',
multiplier: 1,
bound: scoring.boundTriangle,
score: scoring.scoreTriangle,
minSide: 0.28,
closingDistance: scoring.closingWithLimit,
closingDistanceFree: 0.8,
closingDistanceFixed: 0.8,
rounding: round2,
finalRounding: round1,
cardinality: 3,
code: 'fai',
},
],
I compared it with Brigitte's record in this post and this is what gives consistent answers to the official score:
#94 (comment)
from igc-xc-score.
So I currently believe that neither for Triangle nor for OAR the cylinders should be used. Their current "reference" software is SeeYou, which doesn't do anything with cylinder.
For OAR the closing point at the midpoint is I believe the optimal point. For Triangle what is your opinion? It would be optimal at midpoint but too expensive to calculate or implement?
from igc-xc-score.
For triangles, the closing does not require optimization - it is a deterministic problem that can be solved by a direct approach - a classical nearest-neighbor problem - which is a very well studied problem in computational geometry.
Currently, for all flights except OAR1, once the turn points have been selected, the shortest closing is found.
In OAR1, the closing is part of the optimization. In OAR1, the best placement would be the furthest away point, but the FAI rules say that it must be the point in the middle. OAR1 is the only type of flight where the shortest closing might not be the highest scoring one.
from igc-xc-score.
I understand, thanks. I've plotted OAR1 and OAR2 on top of each other, but I don't quite understand it yet.
from igc-xc-score.
OAR1 has only 1 turnpoint and a closing which also serves as the second turnpoint - placed on the middle of the closing line.
OAR2 is a classical circuit flight - it has two turnpoints - and a triangle-style closing which is the other line.
from igc-xc-score.
OAR1: Best solution is optimal Out-and-Return Distance 207.5 points, 207.5km, multiplier is 1 [ closing distance is 0.8km ]
OAR2: Best solution is optimal Out-and-Return Flight around 2 TPs 207 points, 207.8km, multiplier is 1 [ closing distance is 0.8km ] [ penalty is 0.8km ]
So OAR2's point precisely is 207.8 - 0.8 and OAR1's point is 207.5 without any penalty right? So OAR1 is a tiny bit better always right?
from igc-xc-score.
OAR2 should always have a higher score. In this particular example the OAR2 flight has the closing distance as a penalty - because these are the British XCLeague rules, while the OAR1 flight has no penalty, because these are the FAI rules.
The FAI OAR2 should (probably?) have closingDistanceFree: 0.8
- in this case its score will be slightly higher.
from igc-xc-score.
The reason why the cylinders were so computationally expensive is that I didn't rewrite the bounding function - which was a huge task. With a good bounding function, the cylinders should not be more expensive than the rest.
from igc-xc-score.
But what is OAR2 closing doing exactly? Finding the best point on the second half of the track which is <=800 meter from the first half?
from igc-xc-score.
Sorry for the late reply, OAR2 is distance around two turn points. XCLeague has it - as the only out-and-return type and FAI has it - as one of its out-and-return types. FAI calls it Distance around two turn points. The optimization selects two turn points so as to maximize the distance between them, and a separate closing, the shortest possible one. The closing is not part of the scoring unless there is a penalty.
from igc-xc-score.
Related Issues (15)
- Question about IGC Parser HOT 2
- Box.distance() bug ?
- Possible speedup HOT 2
- Proper rounding procedure HOT 2
- Strip/tree shake debug code HOT 7
- Unhandled exception in 1.7.0 beta with some flights
- FAI-OAR flights report a wrong distance when used without cylinders
- Demo not working in Windows browsers HOT 2
- [Question] Perfomance HOT 3
- Scoring is undefined HOT 3
- Cannot read properties of undefined (reading 'heapUsed') HOT 2
- Parsing multiple igc file in a cause mac terminal to crash HOT 15
- Cannot read property 'r' of undefined HOT 5
- Moving average / flight detection HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from igc-xc-score.