Giter VIP home page Giter VIP logo

Comments (2)

DrPaulBrewer avatar DrPaulBrewer commented on June 3, 2024

What is failing ?

No market functionality is involved

This tests what happens if we start a simulation with an immediate deadline.

What the test expects to happen is to receive 1 period of results.

Instead, sometimes the system is fast enough to return 2 periods.

That fails the test.

Fix

The checking of the deadline has a minor defect.

The simulation code in src/index.js, function run(options) looks at if ((deadline) && (Date.now()>deadline)) and the "strict greater than" > will not end the simulation when Date.now()===deadline. Although Date.now() should have a 1 ms precision, we don't know how well the system keeps it updated... especially since the highest rate of these was on an HP with an older i5-3000s series processor ... but apparently it is possible to process 2 periods before Date.now() updates to be greater than deadline.

The fix is to use Date.now()>=deadline (greater than or equal to) to check the deadline.

This requires two minor changes to the run() function, once for the synchronous options and once in the asynchronous option.

from single-market-robot-simulator.

DrPaulBrewer avatar DrPaulBrewer commented on June 3, 2024

Minor fix to deadline code released as version 5.7.0

from single-market-robot-simulator.

Related Issues (15)

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.