Skip to main content
Filter by
Sorted by
Tagged with
-2 votes
1 answer
57 views

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 ...
user10422605's user avatar
0 votes
0 answers
75 views

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 ...
Plague's user avatar
  • 1
0 votes
1 answer
127 views

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 ...
Nombre de Usuario Genérico's user avatar
0 votes
1 answer
83 views

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 ...
Ira S's user avatar
  • 111
6 votes
3 answers
373 views

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,...
raven's user avatar
  • 529
0 votes
0 answers
84 views

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 ...
HelloContinent's user avatar
0 votes
0 answers
68 views

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 ...
Andy W's user avatar
  • 1
3 votes
1 answer
146 views

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 ...
MManke's user avatar
  • 133
4 votes
2 answers
175 views

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 ...
Huzaifa Imran's user avatar
0 votes
2 answers
182 views

You have 𝑛 items. Each object has a weight, the weight of the object numbered 𝑖 is equal to 𝑥_𝑖. You need to put them in a backpack that holds no more than 𝑆g. At the same time, you want the ...
KarlLa's user avatar
  • 19
0 votes
1 answer
149 views

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. ...
Abhishek jaiswal's user avatar
0 votes
0 answers
104 views

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 ...
Stratos_22's user avatar
-4 votes
3 answers
103 views

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 ...
Matay Mayrany's user avatar
4 votes
1 answer
286 views

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) ...
slaw's user avatar
  • 6,999
1 vote
0 answers
50 views

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 ...
Magdy Fares's user avatar
0 votes
1 answer
76 views

This is the code I used: class Solution { //Function to return max value that can be put in knapsack of capacity W. static int knapSack(int W, int wt[], int val[], int n) { // ...
ammu's user avatar
  • 11
2 votes
1 answer
139 views

Consider a list of weights and a list of bags with variable weights. I need an algorithm that finds the minimum number of bags needed to store all weights. Simply sorting in decreasing order doesn't ...
ela16's user avatar
  • 857
0 votes
1 answer
134 views

Person X can only work for atmost 10 hours in a day. Given two arrays consisting of wages and duration of work of jobs, what is the maximum amount X can earn in a day? One of the test cases was: wage ...
Dnyanesh Shinde's user avatar
3 votes
1 answer
208 views

I am trying to make an algorithm that finds the sequence of spell that maximizes the total damage. I understood this situation as a 0-1 knapsack problem with cooldown for each item. However, I couldn'...
evol1102's user avatar
1 vote
0 answers
96 views

I have bins that I'm packing components into, but have trouble with components of smaller sizes not "using" the available space in the current bin (so I am creating a new bin when it isn't ...
Parrotmaster's user avatar
0 votes
3 answers
479 views

The Fractional Knapsack Problem revolves around selecting items from a given set to fit into a knapsack of limited capacity. Each item has a weight and a value associated with it, and the goal is to ...
ShouryaSetu's user avatar
2 votes
2 answers
675 views

I have a list of 500 elements each with 2 values x (float value from 0-Infinity) and a y (float value from 0-1). I need to find the cheapest (lowest sum(x)) combination of 10 of these elements that ...
caidora's user avatar
  • 23
1 vote
0 answers
90 views

I was solving the CSES-Apple Division Problem. It was a dp sum difference minimization problem. We have to divide an array into two subsets whose sum difference is minimum. I was using basic Recursion ...
Red_RanGer's user avatar
-1 votes
1 answer
62 views

I am trying to solve GeeksforGeeks problem 0 - 1 Knapsack Problem : You are given weights and values of N items, put these items in a knapsack of capacity W to get the maximum total value in the ...
Balbir singh's user avatar
0 votes
0 answers
51 views

Following a course on algorithmic trading on python. However, 20 minutes in, run a command and get this. Please help. tried everything the code i ran. Everything is updated and I have tried everything....
Boris 's user avatar
0 votes
0 answers
54 views

I'm trying to fix this for a whole night but still the program doesn't work, and I felt like there's nothing wrong with it. The list taken is responsible for recording the objects that's being carried ...
whiteSilence11's user avatar
1 vote
1 answer
176 views

The length of each vector is equal to 3. The number of vectors is no more than 300 and sum of the sum of all vectors is no more than 500. Example: For set of vectors: [0, 0, 1], [2, 3, 4], [0, 5, 0], [...
queue's user avatar
  • 11
3 votes
1 answer
192 views

I'm looking for people with some algorithmic knowledge who can help me out with this. I'm currently programming a constrained tree search in java, where I want to have a certain amount of leaf nodes ...
ChomskyEnjoyer's user avatar
0 votes
0 answers
34 views

Hello I have 5 blanks on the Python code below in bmax_val() and bfast_max() functions I'm trying to draw recursion tree as a result but it's too difficult to solve this problem I tried to put indent =...
CocaCola's user avatar
3 votes
1 answer
329 views

I am fairly new to python and I have a task which tells me to compare both algorithm time expended and space used in memory. I have coded both algorithms and ran them both. I was able to measure the ...
zellez11's user avatar
  • 400
1 vote
1 answer
113 views

public List<Waste> main(List<Waste> nowStock) throws Exception { Loader.loadNativeLibraries(); HashMap<@Nullable Integer, @Nullable Waste> iToWaste = Maps.newHashMap(); ...
冯佳奇's user avatar
0 votes
2 answers
61 views

L = number of given itens 0 < L < 31 P[j] = price of item j M = smaller quantity of items I must have Q = Greater quantity which can be spent Also, I can't have more than one item of each type. ...
Tomás Nascimento's user avatar
0 votes
1 answer
46 views

enter image description here please how can i use flat button now? I am trying to solve this and expected that someone will help me here.
Tanveer Syed's user avatar
0 votes
0 answers
81 views

This problem has been asked before: the problem however I have been struggling for a while to debug where my logic is wrong because my algorithm fails on this unknown test case: Failed case #7/13: ...
codinator's user avatar
-1 votes
1 answer
330 views

Hi I have a question about knapsack problem and it's algorithms. I have built some code to solve 0/1 knapsack problem with Dynamic Programming and Branch and Bound. The value and weight are randomly ...
Ohtani King's user avatar
3 votes
2 answers
458 views

I am trying to find a way to have as few boxes as possible that fit bags of chemicals. A box cannot have weight more than 3.3 kg but have to be higher than 2.7 kg. I came across Google's OR tools but ...
zoc99's user avatar
  • 105
0 votes
1 answer
36 views

The problem receives an input like [[500, 5, 1], [450, 2, 1], [400, 5, 1]], where each row represents a buyer. Each buyer has a value in position 0, which represents the amount they are willing to pay ...
Nicolas Fredsny's user avatar
0 votes
0 answers
74 views

I've been struggle on this problem over than 2 weeks, I've data like below : Someone told me it's should knapsack or anything, but I don't know how to do. Master Category Category Qty per Box P 12 V 8 ...
shev's user avatar
  • 1
1 vote
1 answer
60 views

I am trying to use MPI to develop a parallel solution in C to the NP-Complete Knapsack problem. When I run the code, the printf statement at the end of the first if statement outputs as rank 14, not ...
IrrationalPi's user avatar
0 votes
1 answer
289 views

I have the below dataframe: import itertools import pandas as pd import numpy as np p1_values = np.arange(19, 29.1, 0.1) p2_values = np.arange(23, 33.1, 0.1) p3_values = np.arange(36, 46.1, 0.1) ...
Manny's user avatar
  • 63
0 votes
1 answer
85 views

I had a lot of problems with my program recently, as I am not able to create a Collection which has duplicate keys at the same that refer to a different value. It's like an array in a List. I already ...
Glandorf's user avatar
3 votes
1 answer
115 views

I have two knapsacks, let's call them knapsack A, and knapsack B, each knapsack has a max weight limit. We also have some item types that we can take with us. Each item type has a price, and two ...
adamsass's user avatar
0 votes
0 answers
209 views

this is my first question on stack overflow and I am quite new to OR, so bear with me. I am trying to solve what could be considered a rectangular 2D knapsack problem with a twist. In order to solve ...
Felix Burmester's user avatar
0 votes
1 answer
125 views

I need to solve the below knapsack problem to maximize value while staying within the knapsack's weight W. n is the number of items available W is the weight capacity of knapsack wt is the weight ...
Malyada N's user avatar
0 votes
0 answers
49 views

Hi i am very new to genetic algorithm and i am stuck with this problem: A move is provided for a student. He has to store his things in small plastic boxes in a cardboard box with a capacity of 2 ...
QTARO's user avatar
  • 1
1 vote
2 answers
379 views

I have a data table containing n=100 elements : Element weight value A 24 80 B 43 77 C 51 72 D 38 70 E 27 65 F 7 58 .. .. .. And I would like to create an algorithm to get 5 elements where : sum of ...
gnozer44's user avatar
0 votes
1 answer
76 views

def knapSack(W, wi, pi, i): if i == 0 or W == 0: return 0 if (wi[i-1] > W): return knapSack(W, wi, pi, i-1) else: return max( pi[n-1] + ...
Sina sam sina_mix's user avatar
0 votes
1 answer
114 views

I implemented the 0/1 knapsack problem with the backtracking technique, but I didn't get the expected result. capacity : total knapsack capacity cargo_number : the number of items size : the weight ...
Asahisuki's user avatar
2 votes
1 answer
801 views

Expanding upon a common dynamic programming solution for the knapsack problem: def knapSack(W, wt, val, n): results = [] K = [[0 for x in range(W + 1)] for x in range(n + 1)] # Build tаble ...
Olivia's user avatar
  • 814
-1 votes
1 answer
350 views

i used dynamic programming to solve knapsack problem. #include <iostream> using namespace std; #define number 4 // number of item type typedef struct iteml { int itemw; // [weight of item] ...
RyuJin's user avatar
  • 1

1
2 3 4 5
22