Coder Social home page Coder Social logo

multiple-choice-knapsack-problem's People

Contributors

tmarinkovic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

multiple-choice-knapsack-problem's Issues

Update to require 1 item from each group in result knapsack

Hello!

I was looking to use your code however after running it I realized that this is a variation of the MCKP, where it returns 0-1 of each item group.

I would and I think the rest of the world would really appreciate a variation of your algorithm that selects 1 item from each group, so 1-1 MCKP. Basically if there are 5 groups, we always have 5 items in the knapsack, 15 groups we always have 15 items in the knapsack.

Please let me know if you have any questions or if I can help in anyway.

Thank you

NoGroupProblem doesn't work

Hi,

The "NoGroupProblem" does not produce a valid solution. For the predefined problem

...
this.bagSize = 15;
this.profit = new int[]{0, 15, 11, 5, 8, 12, 18, 20, 14, 8, 9, 6, 10, 50, 7, 2, 3, 6, 5};
this.weight = new int[]{0, 8, 4, 4, 3, 5, 14, 11, 5, 4, 6, 3, 5, 1, 5, 3, 2, 9, 7};
this.group = new int[]{-1, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 4, 4, 4, 4};
...

I get Items picked: 13 with total profit of 50 and weight 1, which is obviously wrong. The correct solution would be: Items picked: 2, 5, 8, 13 with total profit of 87 and weight 15

At the moment I'm not able to provide a working solution, I'm still in the process of understanding the knapsack...

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.