dwave-examples / knapsack Goto Github PK
View Code? Open in Web Editor NEWImplementation of knapsack problem, set up for scaling to large problem size
License: Apache License 2.0
Implementation of knapsack problem, set up for scaling to large problem size
License: Apache License 2.0
The readme can be improved with:
The idea is to get this demo's explanation to work better as a standalone (rather than needing a user to go and read a paper)
currently, the way the inequality constraint is built is very involved. The code can be simplified significantly by using .add_linear_inequality_constraint
.
If the goal is to teach users how to work with slack variables, using a higher-level function is not needed. However, more users can expand this example to an application, if it's simplified.
According to this paper, https://arxiv.org/pdf/1302.5843.pdf, a constraint is used to make sure only one value of y equals one.
\sum_i y_i = 1
However, in the code, another implementation is used in which a logarithmic number of binary variables are used to create values between 1-N. Any combination is feasible.
Add cqm
tag to the knapsack example so it is retrieved in a search in Leap collection of examples
A couple of the examples use the ExactSolver in tests (it's passed in as the sampler). The ExactSolver does not take in any keyword arguments, so passing in 'label' causes the test to fail with TypeError: sample() got an unexpected keyword argument 'label'
.
I'm wondering if we should update the ExactSolver to just swallow keyword arguments. Or if this is considered bad practice, in which case we just need to modify a few examples including this one.
Reformat the ReadMe so it's consistent with the other code examples (add Problem Formulation section)
See failed tests. The problems seems to be with the hardcoded solver name. /cc @joelgdwave
Line 44 in 8064923
Should this be log2?
Opening a new Knapsack example and hitting the green play button gives results that do not satisfy the maximum weight constraint out of the box.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.