Ice Cream : NP-complete problem

  • MHB
  • Thread starter mathmari
  • Start date
  • Tags
    Ice
In summary: B$ is a set of vertices and $s_i$ is an edge.It's a type error to say that $s_i\in B$.Since there is no algorithm that solves the Vertex Cover Problem in polynomial time, i.e. the Vertex Cover Problem is NP-complete, we conclude that the ice cream problem is also NP-complete.Better: "...checks if they contain all $m$ flavors".Yes.Is the whole proof the following?First of all, we have to show that the problem is in NP. A non-deterministic Turing Machine guesses $k$ cups and then it checks if each of the $m$ ice
  • #1
mathmari
Gold Member
MHB
5,049
7
Hey! :eek:

An ice cream shop has $m$ kinds of ice creams $s_1, \dots , s_m$. On the card there are $n$ cups $b_1, \dots , b_n$. Each cup contains some of the ice cream kinds. The budget of Gina suffices for $k$ cups. Gina wants to choose $k$ cups so that each of the $m$ ice cream kinds are occured. I want to show that Gina has a NP-complete problem.
I have to use reduction of Vertex Cover.

The Vertex Cover problem asks if for a graph $G= (V, E)$ and a $k$ there is a subset $C\subseteq V$ such that for each edge $(u,v)\in E$ it holds that $u\in C$ or $v\in C$.

To reduce the Vertex Cover to the above problem do we see the vertices as the cups and the edges as the ice cream kinds? (Wondering)
 
Physics news on Phys.org
  • #2
mathmari said:
An ice cream shop has $m$ kinds of ice creams $s_1, \dots , s_m$. On the card there are $n$ cups $b_1, \dots , b_n$.
What card?

mathmari said:
Each cup contains some of the ice cream kinds.
So a cup may contain several ice cream kinds (flavors)?

I am not sure I understand the description.
 
  • #3
Evgeny.Makarov said:
What card?

So a cup may contain several ice cream kinds (flavors)?

I am not sure I understand the description.

Yes, with kinds I mean flavors and with card I mean the menu. (Blush)

So, it is as follows:
An ice cream shop has $m$ flavors of ice creams $s_1, \dots , s_m$. On the menu there are $n$ cups $b_1, \dots , b_n$. Each cup contains several ice cream flavors. The budget of Gina suffices for $k$ cups. Gina wants to choose $k$ cups so that each of the $m$ ice cream flavors exists. I want to show that Gina has a NP-complete problem.
 
  • #4
mathmari said:
To reduce the Vertex Cover to the above problem do we see the vertices as the cups and the edges as the ice cream kinds?
Yes.
 
  • #5
Is the whole proof the following?

First of all, we have to show that the problem is in NP. A non-deterministic Turing Machine guesses $k$ cups and then it checks if each of the $m$ ice cream flavors exists. The Turing Machine needs polynomial time for that, and especially time $m$.

Then to show that the problem is NP-hard we reduce the Vertex Cover Problem to the above one.
We see the vertices as the cups and the edges as the ice cream flavors. Therefore, there is a subset $B$ of the set of the cups such that for each flavor $s_i$ it holds that $s_i\in B$ iff there is a subset $C\subseteq V$ such that for each edge $(u,v)\in E$ it holds that $u\in C$ or $v\in C$.
That means that the above problem has a solution iff the Vertex Cover Problem has a solution.
Since there is no algorithm that solves the Vertex Cover Problem in polynomial time, i.e. the Vertex Cover Problem is NP-complete, we conclude that the ice cream problem is also NP-complete.

Is everything correct? Could I improve something? (Wondering)
 
  • #6
mathmari said:
First of all, we have to show that the problem is in NP. A non-deterministic Turing Machine guesses $k$ cups and then it checks if each of the $m$ ice cream flavors exists.
Better: "...checks if they contain all $m$ flavors".

mathmari said:
The Turing Machine needs polynomial time for that, and especially time $m$.
It's unlikely the time is precisely $m$.

mathmari said:
Then to show that the problem is NP-hard we reduce the Vertex Cover Problem to the above one.
We see the vertices as the cups and the edges as the ice cream flavors. Therefore, there is a subset $B$ of the set of the cups such that for each flavor $s_i$ it holds that $s_i\in B$ iff ...
$B$ is a set of vertices and $s_i$ is an edge. It's a type error to say that $s_i\in B$.

mathmari said:
there is a subset $C\subseteq V$ such that for each edge $(u,v)\in E$ it holds that $u\in C$ or $v\in C$.
This is the first time $V$ and $E$ are used.

mathmari said:
Since there is no algorithm that solves the Vertex Cover Problem in polynomial time
This conjecture is still unproved.
 
  • #7
First of all, we have to show that the problem is in NP. A non-deterministic Turing Machine guesses $k$ cups and then it checks if they contain all $m$ flavors. The Turing Machine needs polynomial time for that.
Why is the time not $m$ ? (Wondering)

Then to show that the problem is NP-hard we reduce the Vertex Cover Problem to the above one.
We see the vertices as the cups and the edges as the ice cream flavors.
Therefore, there is a subset $B$ of the set of the cups such that each flavor $s_i$ is in one cup of $B$ iff there is a subset of the set of vertices $C\subseteq V$ such that for each edge $(u,v)\in E$, where $E$ the set of edges, it holds that $u\in C$ or $v\in C$.
That means that the above problem has a solution iff the Vertex Cover Problem has a solution.
Since there is no algorithm that solves the Vertex Cover Problem in polynomial time, i.e. the Vertex Cover Problem is NP-complete, we conclude that the ice cream problem is also NP-complete.

Evgeny.Makarov said:
This conjecture is still unproved.

What do you mean? (Wondering)
 

FAQ: Ice Cream : NP-complete problem

What is an NP-complete problem?

An NP-complete problem is a type of problem in computer science that is considered to be one of the most difficult to solve. It falls under the category of "non-deterministic polynomial-time complete" problems, which means that it cannot be solved in a reasonable amount of time using traditional algorithms.

How is "Ice Cream" an NP-complete problem?

The "Ice Cream" problem refers to a theoretical scenario in which a person is trying to choose a combination of flavors from a limited number of options to satisfy a set of constraints. This problem has been proven to be NP-complete, meaning that it falls under the category of NP-complete problems and therefore has no efficient solution.

What makes the "Ice Cream" problem difficult to solve?

The "Ice Cream" problem is difficult to solve because it requires considering all possible combinations of flavors and evaluating them against multiple constraints. As the number of options and constraints increases, the number of potential combinations grows exponentially, making it nearly impossible to find the optimal solution in a reasonable amount of time.

Can the "Ice Cream" problem be solved using traditional algorithms?

No, the "Ice Cream" problem cannot be solved using traditional algorithms due to its classification as an NP-complete problem. Traditional algorithms are not efficient enough to handle the large number of potential combinations and constraints involved in this problem.

How is the "Ice Cream" problem relevant to real-world situations?

The "Ice Cream" problem may seem like a purely theoretical concept, but it has real-world applications in fields such as computer science, economics, and logistics. It serves as an example of an NP-complete problem and highlights the limitations of traditional algorithms in solving complex problems with multiple constraints.

Similar threads

Replies
1
Views
1K
Replies
1
Views
2K
Replies
2
Views
1K
Replies
8
Views
791
Replies
1
Views
2K
Replies
1
Views
1K
Replies
1
Views
2K
Replies
1
Views
3K
Replies
1
Views
2K
Back
Top