Giter Club home page Giter Club logo

knapsack_algorithm's Introduction

Knapsack_Algorithm

NP -Hard - Knapsack algorithm implementatioen using Dynamic Programming in Python Language.

This program accepts the value and volumne matrix from the user of same size and also prompt the user to enter the total wanted capacity on which the Knapsack algorithm is to run.

Testing the algorithm with the following values: value=[7 9 5 12 14 6 12] Volume=[3 4 2 6 7 3 5] Capacity = 15

Output = 34

Need to find out the products of maximum total value such that the sum of their volumes is at most 15

Time complexity of the algorithm is : O(nW) where n is the number of items and W is the capacity of knapsack.

when the numbe of input size increases so is the complexity. Complexity of the current algorithm is more than that of the Google OR-Tools. Since in is implemented using dynamic programming, so the space complexity increses as the O(nW). Space complexity can be improved by using only 1D Vector rather than the matrix.

There are som neural network using which we can improve this algorithm, like given in the link: https://towardsdatascience.com/neural-knapsack-8edd737bdc15

This requires the proper test data to be created and then training the Neural network.

knapsack_algorithm's People

Contributors

carola173 avatar

Watchers

 avatar  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.