We are given the following integer linear program:
\begin{equation} \begin{array}{c} \max x_{1}+2 x_{2}+2 x_{3}+3 x_{4} \\ \text { such that } 2 x_{1}+3 x_{2}+x_{3}+2 x_{4} \leq 4, \\ \text { where } x_{1}, x_{2}, x_{3}, x_{4} \in\{0,1\} \end{array} \end{equation}
The task is to express this as a dynamic program.
I know that we have to simplify a complicated problem by breaking it down into simpler sub-problems in a recursive manner. However, I cannot figure out how to do so in such a context, no recursive pattern comes to mind.
Help much appreciated.
Let $v_i$ be the objective coefficient of $x_i$, and let $w_i$ be the constraint coefficient of $x_i$. Let $f(k,b)$ be the maximum when you restrict to the variables $x_1,\dots,x_k$ and a budget of $b$, so that the original problem is to compute $f(4,4)$. By conditioning on the value of $x_k\in\{0,1\}$ we obtain DP recursion $$f(k,b) = \max\{f(k-1,b), v_k+f(k-1,b-w_k)\}$$