Code Monkey home page Code Monkey logo

reoptimization-algorithms's Introduction

Reoptimization Algorithms

Latest Version

Package implementing some well known Reoptimization algorithms

https://mek97.github.io/reoptimization-algorithms/_images/header.png

Perterson Graph (Made using GeoGebra)

Currently, considerable efforts must be put to find optimal solution for NP-Hard problems. Reoptimisation deals with, If given an optimal solution to a problem instance IO, can we find a good approximated solution to instance IN, where IN is IO with some 'local' modifications? The goal in this repository is to expose some well known reoptimization algorithms.

  • (Recommended) Python versions: >=3.6, <=3.9.*
  • Option 1

    To Install the stable latest package from pypi host

    pip install reoptimization-algorithms

  • Option 2

    To install directly from this repository execute the following in repository root directory

    python setup.py install

import reoptimization_algorithms as ra

old_graph = (ra.UndirectedGraph().add_vertex("4").add_edge("4", "5").add_edge("40", "50")
             .add_vertex("6").add_edge("4", "8").add_vertex("99").delete_vertex("6"))
attached_graph = ra.UndirectedGraph().add_edge("90", "95")
attach_edges = [ra.Edge("4", "90")]
old_solution = {"8"}

solution = ra.UnweightedPVCP.reoptimize_ptas(old_graph, attached_graph, attach_edges,
                                             old_solution, k = 3)
print(solution) # {"4"}

For detailed documentation and usage refer here

Implementation basically consists of

  1. Having a graph data structure utility
  2. Implementing the graph algorithms

Algorithms implemented

  • PTAS for Reoptimization of unweighted k-path vertex cover under constant size graph insertion

Want to add or improvise the repository? Check out the Contributing documentation :)

reoptimization-algorithms's People

Contributors

actions-user avatar mek97 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

reoptimization-algorithms's Issues

Method update_edge raising exception

Method update_edge raising exception

The following update_edge method call

import reoptimization_algorithms as ra

ra.UndirectedGraph().add_edge("4", "5", 11).update_edge("4", "5", 10)

Raises

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/mehul.kumar/opt/anaconda3/envs/p3.7/lib/python3.7/site-packages/reoptimization_algorithms/utils/graph/graph.py", line 260, in update_edge
    self.get_vertex(source).add_neighbour(destination, weight)
  File "/Users/mehul.kumar/opt/anaconda3/envs/p3.7/lib/python3.7/site-packages/reoptimization_algorithms/utils/graph/vertex.py", line 129, in add_neighbour
    raise Exception(f'Neighbour {neighbour} already exists for {self.__key}, delete it first')
Exception: Neighbour 5 already exists for 4, delete it first

Contributing Link is directing to release branch

Describe the bug
Contributing link in read me and docs is directing to release-v0 branch

Expected behavior
Contributing link in read me and docs should directing to master branch

Screenshot
Screenshot 2020-07-26 at 10 42 39 PM

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.