1,094 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
-2
votes
1
answer
57
views
I want to fix a "int' object is not subscriptable" error [closed]
I'm using genetic algorithm for knapsack problem and when I wanted to debug it says : int' object is not subscriptable
it just pointed this 3 spots in the code and in the end it just said this is the ...
0
votes
0
answers
76
views
Why this code for 0/1 knapsack problem works for some examples?
Problem Statement
There are N items, numbered 1, 2, ..., N.
For each item i (1 ≤ i ≤ N):
It has a weight w[i]
It has a value v[i]
Taro wants to choose some of these N items and carry them home in a ...
0
votes
1
answer
128
views
Knapsack 0/1 variation maximize the number of objects with independent weight restrictions
I'm trying to use dynamic programming to solve a knapsack variation, where you are given an array of containers, each of them having a weight, a resistance and an id, I need to find the tallest pile ...
0
votes
1
answer
83
views
Why does lp() linear solver in R find a better solution when given a smaller subset of options?
Given a set of 140 options, my goal is to select the set of options that minimize the objective function and acheive a constraint that weight must be > 5584 units.
Criteria 1 is the objective ...
6
votes
3
answers
373
views
Subset sum problem with selection constraint in large R dataset
I have a tibble:
sample_tibble <- tibble(
group = c(1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4),
threshold = c(100, 100, 100, 100, 100, 80, 80, 80, 80, 80, 80, 150, 150, 150,...
0
votes
0
answers
85
views
Multiple knapsack total value optimization
Problem description:
A store has N boxes where sequences of bottles can be placed (a sequence can be empty), with each box having a bonus factor c_i and a weight l_i.
There are only K bottles ...
0
votes
0
answers
69
views
Unable to input and output properly when programming a Knapsack problem
I am trying to solve a Knapsack problem with a two-dimensional array on CodeBlocks, but after the program runs, I press the number on the keyboard, and the running terminal does not display the number ...
3
votes
1
answer
147
views
How can I reduce the time complexity of the solution my subset optimization problem?
I have a list of tuples (a, b) of two unrelated positive integers. I am trying to create another list based off of this that maximizes the sum of a, while staying above a threshold.
I also have two ...
4
votes
2
answers
175
views
Algorithm to minimize the number of printing plates when printing sheets of stickers
I am working on an algorithm for optimizing the costs of a printing company by solving a problem they face. The problem is similar to knapsack problem but with a twist, instead of minimizing the ...
0
votes
2
answers
183
views
knapsack problem - how to cut memory usage
You have n items. Each object has a weight, the weight of the object numbered i is equal to x_i. You need to put them in a backpack that holds no more than Sg. At the same time, you want the ...
0
votes
1
answer
149
views
Error: Version solving failed due to null safety in Dart Flutter project with flutter_tindercard dependency
hot to solve
give me a proper steps
The current Dart SDK version is 3.2.0. Because datingappmain depends on flutter_tindercard >=0.1.1 which doesn't support null safety, version solving failed. ...
0
votes
0
answers
104
views
Having trouble allocating memory in c programm
I have an assignment to solve a Knapsack problem from a set of dataset i'm given and one of the ways i have to do solve it with is branch and bound depth first
The program below works fine when given ...
-4
votes
3
answers
103
views
find number of unique durations given a list of durations and an upper bound
Lets say we are given a list of durations (5s, 10s, 10s, 15s, 15s, 15s, 25s, 30s....) and we want to find a list of unique durations that can be created using this list of single durations.
for ...
4
votes
1
answer
287
views
Knapsack Problem: Find Top-K Lower Profit Solutions
In the classic 0-1 knapsack problem, I am using the following (dynamic programming) algorithm to construct a "dp table":
def knapsack(weights, values, capacity):
n = len(weights)
...
1
vote
0
answers
51
views
Quite Hard DLX Optimizing JavaFX 3D Grid Manipulation for Performance
I'm working on a JavaFX project where I need to manage a 3D grid representing a Tetris-like game environment. My current implementation involves multiple nested loops and array manipulations, which I ...