GithubHelp home page GithubHelp logo

mmomtchev / igc-xc-score Goto Github PK

View Code? Open in Web Editor NEW
42.0 6.0 6.0 10.19 MB

A scoring program for gliding competitions striving for 100% accuracy and determinism

License: GNU Lesser General Public License v3.0

JavaScript 95.83% CSS 0.16% HTML 4.02%
optimization-algorithms flights igc paragliding branch-and-bound

igc-xc-score's Issues

Could the solver accept a flight less than 5 points?

Hi,

With @vicb, we are working on the integration of igc-xc-score in flyxc. In some cases, the flights we are sending to the solver have less than 5 points. Under this limit, the solver returns an error.
Do you think that this limitation could be removed from igc-xc-score.
Would you accept a PR to solve this issue?

Cannot read properties of undefined (reading 'heapUsed')

Hi, i enter a strange bug. your package works as expected in a parcel/vanilla JS environnement, but in a webpack/vuejs environnement I got this error Cannot read properties of undefined (reading 'heapUsed') at solver (line 70)

const mem = process.memoryUsage();

mem is undefined ...

[Question] Perfomance

Hey Momtchil,

Do you have any idea on how this code perform vs a C implementation of the same algo ?

I'd like to integrate igc-xc-score with flyxc in the coming months.

As part of that I'm interested in how a node C-extension would perform and also how WASM would perform.

Would be great if you have some insights - if not I'll try to keep with issue updated with my findings.

Thanks

Moving average / flight detection

I think that the moving average could be implemented much more efficiently by only adding the new point and removing the old from a long running sum instead of recomputing the complete sum for every single point.

I think there is also a bug as the sums get divided by the number of samples instead of the time.

It would be great if the flight definitions are passed as an argument instead of using global variables.

Maybe it would be nice to move this code to a separate library ?

Cannot read property 'r' of undefined

Hello, me again :)

I get that one:

/Users/lreenaers/Documents/code/IFly/node_modules/igc-xc-score/index.cjs.js:1
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Function.noop=function(){},Function.identity=function(value){return value},Function.by=function(by,compare){compare=compare||Object.compare,by=by||Function.identity;var compareBy=function(a,b){return compare(by(a),by(b))};returnc
                                                                                                                                                                                                                                                                                                         

TypeError: Cannot read property 'r' of undefined
    at /Users/lreenaers/Documents/code/IFly/node_modules/igc-xc-score/index.cjs.js:1:136165
    at Object.isTriangleClosed (/Users/lreenaers/Documents/code/IFly/node_modules/igc-xc-score/index.cjs.js:1:136210)
    at Object.boundTriangle [as bound] (/Users/lreenaers/Documents/code/IFly/node_modules/igc-xc-score/index.cjs.js:1:140630)
    at Solution.do_bound (/Users/lreenaers/Documents/code/IFly/node_modules/igc-xc-score/index.cjs.js:1:101983)
    at solver_1 (/Users/lreenaers/Documents/code/IFly/node_modules/igc-xc-score/index.cjs.js:1:146651)
    at solver_1.next (<anonymous>)
    at /Users/lreenaers/Documents/code/IFly/index.js:139:60
    at Array.forEach (<anonymous>)
    at processFlights (/Users/lreenaers/Documents/code/IFly/index.js:111:8)
    at Statement.<anonymous> (/Users/lreenaers/Documents/code/IFly/index.js:434:5)

The file being processed is here : file.igc

I called the lib like so:

const IGCParser = require('igc-parser');
const {
  scoring,
  solver
} = require('igc-xc-score');

  var score_flight = IGCParser.parse(row.V_IGC, {
        lenient: true
      });
      var result_ffvl = solver(score_flight, scoring.FFVL).next().value; // <= This triggers the error

Question about IGC Parser

I have included my own copy of igc-parser, otherwise available here, which is less zealous over the quality of the IGC files. You can use the original one or import/require my version which silently ignores IGC errors

I think that it would be nice to (try to) upstream those changes.

Also it would probably be a good idea to add the base version and the differences in your own copy.

I guess you tried the lenient mode of IGC Parser ?

Scoring is undefined

Hello,

I've just updated to 1.6.0 and I got this error:

 var result_ffvl = solver(score_flight, scoring.FFVL).next().value;
                                                     ^

TypeError: Cannot read property 'FFVL' of undefined
    at /Users/lr/Documents/code/IFly/index.js:139:54
    at Array.forEach (<anonymous>)
    at processFlights (/Users/lr/Documents/code/IFly/index.js:112:8)
    at Statement.<anonymous> (/Users/lr/Documents/code/IFly/index.js:434:5)
    at Statement.replacement (/Users/lr/Documents/code/IFly/node_modules/sqlite3/lib/trace.js:25:27)

I tried this :

const {
  scoring,
  solver
} = require('igc-xc-score');
console.log(scoring);
console.log(solver);

... I got this result:

undefined
[GeneratorFunction (anonymous)]

Source code is here : https://raw.githubusercontent.com/Djang0/IFly/master/index.js

Am I missing something ?

Thanks in advance.

Demo not working in Windows browsers

Using the demo at https://www.meteo.guru/xc-score/ I get the following errors when uploading any IGC file:

Windows Chrome Version 90.0.4430.85 (Official Build) (64-bit)
TypeError: Cannot read property 'parse' of undefined

Windows Firefox Version 88.0 (64-bit)
TypeError: igc_parser__WEBPACK_IMPORTED_MODULE_6__.IGCParser is undefined

Windows Microsoft Edge Version 90.0.818.42 (Official build) (64-bit)
TypeError: Cannot read property 'parse' of undefined

Box.distance() bug ?

It seems like ifs are missing brackets ?
(That's why most devs prefer to always use brackets)

Probably x1 and x2 should be initialized to this.x1. together with using else if it would simplify the code.

Strip/tree shake debug code

It would be nice to be able to strip (or tree shake) the debug/test geojson code especially to reduce the payload for websites.

For tree shaking the debug code should be moved out of the class.

Maybe also switch to Typescript ?

Parsing multiple igc file in a cause mac terminal to crash

Hello,

I try to analyse multiple igc file in a loop, causing mac os terminal to become grey and the node process crashes.

this code is being looped for around 200 flights:

console.log('before');
      var score_flight = IGCParser.parse(row.V_IGC, {
        lenient: true
      });

console.log('parsed');

var result_ffvl = solver(score_flight, scoring.FFVL).next().value;

console.log('r1');

var result_xcontest = solver(score_flight, scoring.XContest).next().value;

console.log('r2');

It iterates over 3 flights and crashes at the fourth. console log :

before

parsed

r1

r2

before

parsed

r1

r2

before

parsed

r1

r2

before

parsed

r1

Is there something I'm not doing right?

Proper rounding procedure

Currently the rounding rules of all flight leagues are not 100% clear and igc-xc-score seems to deviate from what is the most common practice, that is, by order:

  • Round each leg separately
  • Sum the rounded legs
  • Round the penalty
  • Apply the penalty
  • Apply the multiplier
  • Round the score

How to use with FAI scoring rules

I'd like to use this with FAI scoring rules, to evaluate record flights. With FAI rules triangle closing needs to be within 400 meter radius fixed. How can I modify it?

So far I find no solution other than copying cli.js and hard coding a different value in my version of cli.js

Possible speedup

The algo currently optimize the score and the most expensive part is the computation of the distance.

Any win in the distance computation could result in a faster algo.

One thing to try would be to optimize score2 instead.

This would remove one expensive Math.sqrt() from each distance computation and it could be applied only once one the outptut.

edit: I don't think it's possible to optimize score2 but maybe there is still something to do with distance2

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.