-1
$\begingroup$

I'm attempting to prove a problem is NPc, but I'm not sure which one would be optimal to use,

The problem is:

There are $n$ boars to be caged, and $m$ cages which each cage being able to hold $k$ boars.

Any boar can be put in in any cage, but certain pairs of boars can't be put together in the same cage.

I'm thinking of SAT or Knapsack to reduce to this problem, but not sure which. If anyone can lead me to the right direction or get me started I'd really appreciate it, thanks

$\endgroup$
  • $\begingroup$ What have you tried? Where did you get stuck? We do not want to just hand you the solution; we want you to gain understanding. However, as it is we do not know what your underlying problem is, so we can not begin to help. See here for tips on asking questions about exercise problems. If you are uncertain how to improve your question, why not ask around in Computer Science Chat? $\endgroup$ – Raphael Sep 16 '17 at 7:01
  • $\begingroup$ Our reference question may help. $\endgroup$ – Raphael Sep 16 '17 at 7:01
0
$\begingroup$

You don't need a reduction. You have a set of objects and you need to assign a number from $\{1, \dots, k\}$ to each object such that certain pairs of objects don't get the same number. There's already a well-known NP-complete problem that fits exactly this description. You're probably most familiar with the case $k=3$, but it's NP-complete for all fixed $k>2$ and also when $k$ is part of the input.

| cite | improve this answer | |
$\endgroup$
0
$\begingroup$

Think about each boar as a node, and connect those boars that may not be put in the same cage with an edge. You will get a graph. Then try to color nodes with $m$ different colors, providing no adjacent nodes have same colors. Those boars with the same color are in the same cage. You should be familiar with $NP$ complete graph coloring problem.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.