Giter VIP home page Giter VIP logo

traffic's Introduction

Traffic Signalling

The project aim is to find an optimal schedule of traffic lights - based on Hash Code 2021 (Online Qualifications)

https://codingcompetitions.withgoogle.com/hashcode/archive

General information

In our first version (simple.py), we generate a random initial solution. Then, in a loop, we generate another random solution and compare it to the initial one. The best solution found is returned. A random solution has a random non-zero ( and bounded) value assigned to each of the streets for all intersections. The order of incoming streets is also random.

The second version (complex.py) implements Simulated Annealing. This sometimes is a very effective method, which doesn’t require a great number of evaluations, as opposed to genetic programming, for example. The main parts are the loop with time stopping criterion and a function generating a random neighbor.

Three .py files:

  • traffic.py - contains definitions and implementations of classes (Intersection, Street, Car and TrafficProblem) as well as a function for initializing the TrafficProblem instance with the values from stdin
  • simple.py - contains
  • complex.py - contains the more advanced version

Launch

On Windows 11 we run scripts with (CMD):

type e.txt | python simple.py > solution.txt 

(an example for e.txt, sample.py and redirection of stdout to solution.txt)

Authors

Kacper Dobek, Stanisław Hapke

traffic's People

Contributors

shapke01 avatar kapiblue avatar

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.