Coder Social home page Coder Social logo

star-traveller's Introduction

Star-Traveller problem

Execution

The code should be run with java 1.8 and python 2.7:

java -jar tester.jar -exec "python StarTraveller.py" -seed 0 -vis

The Problem

Given a 2D grid containing N stars, S ships and U ufos the problem was to have each star visited by at least one ship in 4N moves using the least amount of energy. The cost of moving a ship is given by its traversed Euclidean distance. The problem can be described as a multiple travelling salesman problem (mTSP) with no restriction on the salesman having to return to a designated depot (which seems to be the most popular version in the literature).

There are two addendums to this problem which complicate matters. Firstly the cost of travelling is reduced by a factor of 1000 if a ship tracks a ufo and secondly there is a restriction on the computational capacity in that the simulation needs to run in 20 seconds. Note that N is at most 2000.

The core of the solution presented here involves calculating an intrinsic value for the ufos and then carrying out a cost-benefit analysis to decide whether it is worth moving a ship to track each of the ufos. The value of the ufos is given by their ability to visit new stars in the system. This in turn necessitates the valuation of the stars as well as the probability of visiting new stars.

Lets tackle the star evaluation first. If we were to do this as rigorously as possible then we would evaluate the mTSP at each timestep. The value of a star would then be given by the change in the cost of the mTSP by said stars removal. This is far too costly given the time constraints so we need some heuristic to make these evaluations instead. For each star we choose k of its unvisited nearest neighbors and calculate their average distance. This gives some sense of the remoteness of the star. The more remote the star the higher its valuation.

In order to calculate the intrinsic value of a ufo we also need the expected number of unvisited stars it expects to land on in the remaining number of moves. We record the previous 1000 moves and check how many of those moves involved a visit to a new star. This gives us the current probability of visiting a new star. This probability decreases in time however and we take account of this.

Finally we rank the moves according to (value - cost) and carry out the best moves first.

star-traveller's People

Contributors

stephenosullivan avatar

Watchers

 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.