I am trying to write a knapsack algorithm to generate all possible combinations of four letters (ATGC) and no letter (represented by a space) that’s length totals x. This is part of an error correction program for digital data storage I am working on. My current method uses itertools.product, but it generates a massive number ..

#### Category : knapsack-problem

I am really new into phyton language, i’m doing my homework making simple program. Here’s the code : def knapSack(D, dt, kal, n): if n == 0 or D == 0: return 0 if (dt[n-1] > D): return knapSack(D, dt, kal, n-1) else: return max( kal[n-1] + knapSack( D-dt[n-1], dt, kal, n-1), knapSack(D, dt, kal, ..

Following the guidance by Nicholas Renotte I would like to implement DQN-Agent with OpenAI Gym implementation of Knapsack environment with 5 items. The observation space is basically a tuple of shape (2,6), which defines also the input layer of the Keras model behind the DQN agent. Now I get a struggle with the dimensions of ..

I am trying to solve a problem that concerns the multiple knapsacks problem. The problem is to pack a subset of the objects into five bins, each of which has a maximum capacity of 100, so that the total packed value is a maximum and each bin must have only item with same colors (here ..

try to place N rectangular blocks with different sizes into a grid, by formulating it as a CSP problem. The blocks should not overlap with each other, they can touch on the edges, and there can be empty places. with requirement place 4 rectangular blocks of size 2×2 into a 8×8 grid. I also need ..

I am looking for the formulation of a constraint for a slight variation of the classical multiple-knapsack problem. As in the classical problem, there are items with values and weights to pack into n knapsacks having a maximum capacity. Additionally to the classical problem, I want to enforce the constraint that a specific item can ..

I’m trying to work out an algorithm (likely using OR Tools in Python) for solving a problem that seems to be related to the Knapsack problem. I have a set of items at Location A I want to get them to Location B Each item has a weight and a value I can only carry ..

We have used knapsack algorithm for 3D bin packing and the algorithm is working well. But after loading the boxes, there remains empty spaces. So, can we fill the empty spaces using an online algorithm. Source: Python-3x..

im a new python developers: print(0.1 + 0.1) says a right answer but the problem i have is when i code: print(0.1 + 0.2) in the terminal it says : 0.300000000004 and thats a really bad problem for me as im new to python im new trying to make a calculator and want the math ..

I stumbled on this question, and while it is close, it’s missing some elements that I would need. Binpacking — multiple constraints: weight+volume The question above bases the optimization on weight and volume only. I unfortunately have a bit more complex of an issue. I have a list of materials, their count, their dimensions (length, ..

## Recent Comments