I have an optimization problem I'm struggling with and hoping someone can point me in the right direction.
$\min\ \sum_{i=0}^n x_ip_i$, $ s.t$
$x_i = 0\ or \ q_{\min} \leq c_1(x_i) \leq q_{\max}$,
$\sum c_2(x_i) \leq q_{tot}$, where $x_i$ is the manipulated variable, $p_i$ is a scalar and both $c_1 (x_i)$ and $c_2(x_i)$ are non linear functions.
In addition I have a third constraint which states that any $x_i$ which is different from $0$ has to be in a discrete set such that the set contains indices in ascending order increasing by 1 for each element, e.g. $\{x_3, x_4, x_5, x_7\}$. $\{x_3, x_5, x_7,x_8\}$ would violate this constraint. How do I formulate the first and third constraints so that it can be handled by a solver? And which method is best suited for such a problem?
You can solve the problem via mixed integer nonlinear programming by introducing a binary variable $y_i$ to indicate whether $x_i>0$. The problem is to maximize $\sum_i p_i x_i$ subject to \begin{align} q_\min y_i \le x_i &\le q_\max y_i &&\text{for all $i$} \tag1\label1 \\ q_\min y_i + c_1(0)(1-y_i) \le c_1(x_i) &\le q_\max y_i + c_1(0)(1-y_i) &&\text{for all $i$} \tag2\label2 \\ \sum_i c_2(x_i) &\le q_\text{tot} \tag3\label3 \\ y_i + y_k - 1 &\le y_j &&\text{for all $i<j<k$} \tag4\label4 \end{align} Constraint \eqref{1} enforces the disjunction $x_i \in 0 \cup [q_\min, q_\max]$. Constraint \eqref{2} enforces the implication $x_i > 0 \implies q_\min \le c_1(x_i) \le q_\max$. Constraint \eqref{4} enforces one consecutive interval of positive $x_i$ via the implication $(y_i \land y_k) \implies y_j$.