Minimal vs Minimum solution for Set Cover - approximation

There is a set of items that need to be covered. The subsets of these items are available. If we ask for the minimum number of these subsets that cover the whole items, the problem is the well-known Set Cover problem. Let denote the solution to the Set Cover problem by the minimum solution. However, we have a solution where a subset of items covers all items, and each subset in this solution covers some specific items individually. Let call this solution a minimal solution.
I need to find out how we can find the minimum solution from the minimal solution? What is the best approximation factor to do this?
Regards,

Related

Choosing-not-to-be-adjacent cells: algorithm's time complexity

There is an area made with N 1x1 squares, and all parts of area are connected (there are no inaccessible square from any square).
Here are some examples of area.
I want to select some squares in this area, and two adjacent squares cannot be selected together(diagonally touching is not adjacent).
Can I find maximum quantity of selected squares within time complexity O(N)? And how can I do?
Thank you very much.
The problem you are talking about is called Maximum Independent Set. In all generality it is NP-hard, so you can't expect an efficient algorithm to find the best solution.
However, Maximum Independent Set in all generality is about selecting vertices in a graph. Your problem is about selecting squares in a grid; so your problem is a particular case of Maximum Independent Set. Hopefully, solving Maximum Independent Set restricted to your particular case might be easier than solving it in all generality.
It turns out, grid graphs are bipartite graphs. And Maximum Independent Set restricted to bipartite graphs is easy!
Here is a duplicate question on cs.stackexchange: https://cs.stackexchange.com/questions/3022/maximum-independent-subset-of-2d-grid-subgraph. The accepted answer links some algorithms.
Googling "maximum independent set on a grid" also gives some interesting results.

Algorithm to divide a set of symbols with constraints into minimum number of subsets

I have a set S={a,c,d,e,f,j,m,q,s,t} with a constraint C={am,cm,de,df,dm,ds,ef,em,eq,es,et,fj,fm,fs,jm,js}. xy in C means that x and y cannot be in the same subset. I would like an algorithm to split set S into subsets Sj such that:
1.The number of Sj is minimized
2.The difference between size of each subset is as large as possible
For example in this case, both {{q,a,c,d,j,t},{m,s},{f},{e}} and {{a,c,e,j},{m,s,q,t},{d},{f}} are satisfying 1, but the first is optimal.
Coming from a computer science background, I wonder whether Mathematicians have devised an algorithm for this problem.
As I understand, your task can be rewritten as: find the largest independent subset of vertices S' of graph G=(S, C); repeat the step for graph G'=G\S'.
It's well-known (also pointed by #tobias_k in his comment) that largest independent set of the graph is NP-hard problem (as it's equivalent to the famous clique-problem).
I think this is very hard problem, and that is why. For finding minimum number of subsets, you must solve problem about minimum chromatic number of graph. This problem is generally solved by brute force.

Algorithm for independent set of a graph?

is there an algorithm for finding all the independent sets of an directed graph ?
From what i've read an independent set represents a set formed by the nodes that are not adjacent.
So for this example I would have {1} {2} {1,3}
So how is possible to find all of them, I am thinking about something recursive but I don't really know the algorithm, if someone could point me in the right direction it would be much appreciated !
Thank you!
Typical way to find independent sets is to consider the complement of a graph. A complement of a graph is defined as a graph with the same set of vertices and an edge between a pair if and only if there is no edge between them in the original graph. An independent set in the graph corresponds to a clique in the complements. Finding all the cliques is exponential in complexity so you can not improve brute force much. Still I believe considering the complement of the graph may make the problem easier to deal with.
Other than complement and finding cliques, I can also think about "Graph Coloring", you color the vertices somehow that no two adjacent vertices have the same color (you can do it with a very simple heuristic algorithm like SL = Smallest Last), and then choose vertices in every color as a subset (as a maximal independent subset).
The only problem is that there are probably too many ways of coloring a graph. You have to keep all the found (maximal) independent sets and move on until you get enough sets!
The Bron–Kerbosch algorithm is commonly used for this problem, see the Wikipedia article for a description and pseudocode that can be turned into a useable program without too much problem. The size of output is, in the worst case, exponential in the number of vertices, but brute force will always be exponential while BK will be polynomial if the output is polynomial. In other words if you know that the output will be reasonable then BK will produce it in a reasonable time. This is an active area of research and there are a number of other algorithms that do the same thing with varying efficiency depending of the type and size of graph. There are applications in several areas, in particular genetics.

Greedy algorithm for the following

I am trying to solve the following problem using Greedy Algorithm,
We have n friends and we want to give a present to each one of them. But we don't want to give the same present to two person who know each other. (if x knows y, then y knows x). People who do not know each other may take the same gift, it is okay. We want to minimize the number of distinct gifts given.
Here is what I thought, We try to make pairs of people who do not know each other, and give them all the same gift. But I am not sure whether this is a greedy algorithm. Also, we may want to find maximum group of people in which no one knows any other, so we can give hem the same gift. But can we do this? Can we find the maximum group of people who do not know each other?
Can anyone propose a greedy algorithm for the problem?
The problem you have mentioned is a restatement of Graph Coloring problem. You have to label the graph’s vertices with colors such that no two vertices sharing the same edge have the same color. The link given below is to the Greedy Coloring Algorithm.
http://en.wikipedia.org/wiki/Greedy_coloring
This is graph coloring problem, and greedy algorithm for it is straightforward:
a greedy coloring is a coloring of the vertices of a graph formed by
a greedy algorithm that considers the vertices of the graph in sequence
and assigns each vertex its first available color

Optimization from partial solution: minimize sum of distances between pairs

I have a problem which I like and I love to think about solutions, but I'm stuck unfortunately. I hope you like it too. The problem states:
I have two lists of 2D points(say A and B) and need to pair up points from A with points from B, under the condition that the sum of the distances in all pairs is minimal. A pair contains one point from A and one from B, a point can be used only once, and as many as possible pairs should be created(i.e. min(length(A), length(B))).
I've made a simple example, where color denotes which list the point is from, and the black connections are the solution.
Although this is a nice problem and I suspect is NP-hard, it gets nicer. I can build on existing solutions. Suppose I have two lists and the corresponding solution(i.e. the set of pairs), then the problem I need to solve is to reoptimalize that solution when a point is added to or removed from either list.
I've unfortunately not been able to come up with any non-brute force algorithm yielding the optimal solution. I hope you can. Any algorithm is appreciated in any (pseudo) language, preferably C#.
This problem is solvable in polynomial time via the Hungarian algorithm. To get a square matrix, add dummy entries to the shorter list at "distance 0" from everything.
Your problem is an instance of the weighted minimum maximal matching problem (as described in this Wikipedia article). There is no polynomial-time algorithm even for the unweighted problem (all distances equal). There are efficient algorithms to approximately solve it in polynomial time (within a factor of 2).
This is the minimum weight Euclidean bipartite matching problem. There is a O(n^(2+epsilon)) algorithm.

Resources