496 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
1
vote
1
answer
100
views
Why does Algorithms Illuminated use Turing reductions instead of Karp for NP-hardness
The book Algorithms Illuminated Part 4 has the following definition to prove problems NP-hard:
A problem A reduces to another problem B if an algorithm that solves B can be easily translated into one ...
3
votes
0
answers
59
views
Minimum dominating subgraph
A graph G(V,E) is defined by a set of vertices V and a set of edges E. Given W⊆V, find a connected subgraph G'(V',E') of G that satisfies the following conditions:
i) ∀p∈V,∃p'∈V' such that p′ is ...
0
votes
0
answers
48
views
Aproximation Algorithim for Max Subset Problem
I'm looking for an approximation approach to what I am assuming is an NP hard problem. Given a list of sets F = {S1,...,Sm) that contain at most n elements from (0,...,n-1): what is the largest subset ...
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
1
answer
85
views
How to modify large amounts of data using pandas
As shown in this code, I need to use certain data in one table as a basis to modify another table and add some information. When this kind of table information scale is large, this violent traversal ...
1
vote
1
answer
54
views
Indexing array with subset of argsorted indices
I'm trying to write a decision tree learner in numpy. For this, the x values need to be sorted once only and after that i should be able to reuse them.
For this, I have a 2d array of features x, of ...
0
votes
1
answer
889
views
Example where the greedy approach fails for minimum vertex cover problem
A greedy algorithm to find a vertex cover for a given graph would be to greedily select the vertex with the maximum degree and add it to the vertex cover set. Remove the node and all its edges from ...
0
votes
0
answers
59
views
How to determine optimal grouping?
Problem: Given elements and sets that the elements can corespond to, find optimal division these elements to sets, such that number of sets is minimal.
Example:
'a' : (1, 2),
'b' : (1, 3),
'c' : (3, 5)...
0
votes
0
answers
35
views
How do I implement the np.argmin function for several dimensions [duplicate]
I'm looking for help implementing logic without a loop for the following code. With the present / below code -4D array, I am facing issue since argmin takes just one axis, whereas I need to consider ...
0
votes
1
answer
468
views
i installed numpy 1.26.3 but still not able to use np. method
I installed NUMPY by using pip install NUMPY
and it installed and then I'm still not able to use
np. method .
the NUMPY version is 1.26.3.
the error in "np is not defined".
can somebody ...
1
vote
0
answers
182
views
K-Hamiltonian Path problem and NP-completeness
Consider the K-Hamiltonian Path (KHP) decision problem stated below:
KHP = (G, K), where:
G = (V, E) is an undirected graph of n vertices and m edges
K is a positive integer
Do there exist at least n/...
1
vote
0
answers
59
views
Editing a clique into a k-plex optimally is NP?
A k-plex is a graph in which every vertex is adjacent to all but at most k vertices within the graph. Say I have a complete, undirected, weighted graph (a clique and also a k-plex), and I want to ...
1
vote
0
answers
189
views
NP hardness of bin packing with a fixed number of bins
The general bin-packing problem is NP complete.
I have read several papers and other source but I am still not clear about whether a bin-packing problem with a fixed number of bins is NP-hard.
...
2
votes
1
answer
627
views
Fast algorithm for n-rooks completion puzzle
I am motivated by the post, Complexity of n-queens-completion. I am interested in completion problem of non-attacking rooks on a chessboard.
Input: Given a chessboard of size n×ばつn with n−k rooks ...
3
votes
2
answers
166
views
How to optimize this set-picking algorithm?
I am trying to solve the following problem:
I have several blocked sets (which may contain duplicate elements).
I must pick a (varying) number of elements from each blocked set to unblock it.
I am ...