2
$\begingroup$

I was wondering if the following nonlinear integer programming problem is NP-hard or not.

$$\max_{x_i \in \{0,1\}} \frac{\sum_{i=1}^{n}a_i x_i}{\sqrt{\sum_{i=1}^{n}b_i x_i}}$$

such that $\sum_{i=1}^{n} x_i = K, x_i \in \{0,1\}, ~\forall i \in \{1,\dots,n\}$

where $a_i \in \mathbb{R}$, $b_i \in \mathbb{R}_{+}$, $K > 0$.

$\endgroup$
9
  • 2
    $\begingroup$ For fixed $K$, the problem is in $P$ because there are $O(n^K)$ feasible solutions. $\endgroup$ Commented Sep 1, 2023 at 12:20
  • $\begingroup$ Could you please elaborate more on this? Why are there $๐‘‚(๐‘›^๐พ)$ feasible solutions? $\endgroup$ Commented Sep 1, 2023 at 14:46
  • 1
    $\begingroup$ Exact number of feasible solutions is $\binom{n}{K}$ since you need to pick $K$ indices $i$ (out of total $n$) that will have $x_i=1$. $\endgroup$ Commented Sep 1, 2023 at 14:51
  • $\begingroup$ Can we say it is in $P$ then? I believe that factorial time is not polynomial time... $\endgroup$ Commented Sep 1, 2023 at 14:53
  • 2
    $\begingroup$ @Anson: If $K$ is fixed (does not depend on $n$), the problem is in $P$. If $K$ is not fixed, eg. $K=n/2$, it's likely not in $P$. $\endgroup$ Commented Sep 1, 2023 at 15:03

1 Answer 1

1
$\begingroup$

It is NP-hard. Below is a reduction from the partition problem.

The partition problem asks for a list of positive integers $x_1,\dots,x_n$ whether it can be partitioned into two subsets with equal sum.

Say we want to solve the partition problem on $u_1,\dots,u_n$. Define the list $v$ of size $2n$ by $v_i = 2u_i / (\sum_{i=1}^n u_i)-1/n$ for $1 \le i \le n$ and $v_i = -1/n$ for $n < i \le 2n$. The partition problem is then equivalent to checking whether there is a subset of $v$ with size $n$ and sum zero.

We can then take $K = n$, $a_i = -(1+v_i/4)/n$ and $b_i = (1+v_i/2)/n$ for $1 \le i \le 2n$. Note $-1 < v_i < 2$ so that $a_i < 0 < b_i$. Then your optimization objective is $-1$ if and only if such a subset exists.

To see this, consider some $x$ with $\sum_{i=1}^n x_i = K = n$. Let $A = -\sum_{i=1}^n a_i x_i = 1+\frac{1}{4n}\sum_{i=1}^n v_i x_i$ and $B = 2\sum_{i=1}^n b_i x_i = 1+\frac{1}{2n}\sum_{i=1}^n v_i x_i$. Note that $A = B = 1$ if and only if $x$ selects a subset of $v$ with size $n$ and sum zero. Additionally, note $2A=B+1$. The objective is to maximize $-A/\sqrt B$. It is straightforward to check that $-A/\sqrt B \ge -1$ and $2A=B+1$ has only one solution $A = B = 1$.

Hence, your problem is at least as hard as the partition problem, which is NP-hard.

$\endgroup$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.