Coder Social home page Coder Social logo

workfunctionalgorithm's Introduction

Work Function Algorithm

Brief Description

This repository includes a somewhat naive approach to the Work Function Algorithm for finite general psuedo metric spaces in Python. The implementation is based on the dynamic programming algorithm given in "The k-server problem"-Koutsoupias which is a summary paper which includes the algorithm that Koutsoupias and Papadimitriou introduced earlier.

Included Files

wfa.py - the class implementation

wfa_example.py - an example of the algorithm running on a Euclidean grid with the usual metric. Running will produce PNGs in a figs/ folder.

make_mpg.sh - generates a MOV file from the figures. Requires ImageMagick and the ffmpeg plugin.

Background

K-Server Problem

Given k servers on a pseudometric space, determine a sequence of configurations in an online manner so that a given sequence of requests is served by a server in each corresponding configuration.

Competitiveness

The algorithm has been proven to be (2k-1)-competitive on general metric spaces and has been conjectured to be k-competitive. In a practical sense, this means that no matter how poor a choice requests are, the cost of the Work Function Algorithm is guaranteed to perform no worse than (2k-1) times worse than an optimal algorithm that knows all requests ahead of time. It is known that no deterministic online algorithm can do better than k times the optimal offline.

Work Function Algorithm

The Work Function Algorithm balances the greedy algorithm (assigning the closest server to a request) and the retrospective algorithm (moves servers the optimal configuration assuming the current request is the terminating request). It is the best proven competitive algorithm known for the k-server problem. There are flow implementations that are polynomial in k and the number of points in the space, however this is the original exponential time algorithm with a number of amoritisations included.

Future Updates

There will be two main updates in the coming months,

  1. Fast implementation based on "A fast implementation of the optimal offline algorithm for solving the k-server problem"- Rudec et al.

  2. Limited memory implementation based on "Work function algorithm can forget history without losing competitiveness"- Colussi

Both of these will make using the algorithm more practical or even just feasible for large spaces, sequence lengths and numbers of servers.

workfunctionalgorithm's People

Contributors

adfriedm avatar

Stargazers

 avatar iapilgrim avatar

Watchers

 avatar

Forkers

pilgrim2go

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.