CO Problems =========== We show the basic denotations of graphs. Let :math:`\mathcal{G} = (\mathcal{V}, \mathcal{E}, W)` denote a weighted graph, where :math:`\mathcal{V}` is the node set, :math:`\mathcal{E}` is the edge set, :math:`|\mathcal{V}| = V`, :math:`|\mathcal{E}| = E`, and :math:`W : \mathcal{E} \rightarrow \mathbb{R}^+` is the edge weight function, i.e., :math:`W_{u,v}` is the weight of edge :math:`(u,v) \in \mathcal{E}`. :math:`W_{u,v} > 0` if :math:`(u,v)` is an edge and 0 otherwise. Let :math:`\delta^+(i)` and :math:`\delta^-(i)` denote the out-arcs and in-arcs of node :math:`i`. Integer linear programming (ILP) is a standard formulation of combinatorial optimization problems. It has the *canonical form*: .. math:: :nowrap: \begin{equation} \begin{aligned} \min \quad & \mathbf{c}^T \mathbf{x} \\ \text{s.t.} \quad & A \mathbf{x} \le \mathbf{b}, \\ & \mathbf{x} \ge 0, \\ & \mathbf{x} \in \mathbb{Z}^n, \end{aligned} \tag{1} \end{equation} where :math:`\mathbf{x}` is a vector of :math:`n` decision variables, :math:`\mathbf{c}` is a vector of :math:`n` coefficients for :math:`\mathbf{x}` in the objective function, :math:`A \in \mathbb{R}^{m \times n}` and :math:`\mathbf{b} \in \mathbb{R}^m` together denote :math:`m` linear constraints, and :math:`\mathbf{x} \in \mathbb{Z}^n` implies that we are interested in integer solutions. Let :math:`\mathbf{x}^*` denote the optimal solution and :math:`f^*` denote the corresponding objective value. Only a few problems such as portfolio optimization are quadratic programming, which will be described later. With respect to QUBO or Ising model, we consider a 1D Ising model with a ring structure and an external magnetic field :math:`h_i`. There are :math:`N` nodes with :math:`(N + 1) \equiv 1 \mod N`; a node :math:`i` has a spin :math:`s_i \in \{+1, -1\}` (where +1 for up and −1 for down). Two adjacent sites :math:`i` and :math:`i + 1` have an energy :math:`w_{i,i+1}` or :math:`-w_{i,i+1}` depending on whether they have the same or different directions, respectively. The whole system will evolve into the ground state with the minimum Hamiltonian: .. math:: :nowrap: \begin{equation} f(\mathbf{s}) = - \sum_{i=1}^N h_i s_i + \alpha \sum_{i=1}^N -w_{i,i+1} s_i s_{i+1} \tag{2} \end{equation} where :math:`\alpha` is a weight, :math:`f_A` is defined on each node’s effect on its own, and :math:`f_B` is defined on each two adjacent nodes’ interactions. In fact, we generally use binary variables (0 or 1) to formulate the objective function, and :math:`s_i \in \{+1, -1\}` can be replaced by .. math:: :nowrap: \begin{equation} x_i = \frac{s_i + 1}{2}, \tag{3} \end{equation} where :math:`x_i \in \{0, 1\}`. Graph Maxcut ----------------- .. figure:: /_static/maxcut.png :width: 30% :align: center :alt: An example of graph maxcut **Figure 1: An example of graph maxcut.** The graph maxcut problem is defined as follows. Given a graph :math:`\mathcal{G} = (\mathcal{V}, \mathcal{E}, W)`, split :math:`\mathcal{V}` into two subsets :math:`\mathcal{V}^+` (with edge set :math:`\mathcal{E}^+`) and :math:`\mathcal{V}^-` (with edge set :math:`\mathcal{E}^-`), and the cut set is :math:`\delta = \{(i, j) \mid i \in \mathcal{V}^+, j \in \mathcal{V}^-\}`. The goal is to maximize the cut value: .. math:: \max \sum_{(i,j)\in \delta} W_{ij} Where :math:`W_{ij}` represents the importance (or cost) of edge :math:`(i, j)`, and is usually predefined based on the graph structure. 1. ILP Formulation ~~~~~~~~~~~~~~~~~~ **Take Figure 1 for Example** .. math:: \max \quad \mathbf{y}_{12} + \mathbf{y}_{14} + \mathbf{y}_{23} + \mathbf{y}_{35} + \mathbf{y}_{45} s.t. .. math:: \mathbf{y}_{12} \le \mathbf{x}_1 + \mathbf{x}_2 \\ \mathbf{y}_{12} \le 2 - \mathbf{x}_1 - \mathbf{x}_2 \\ \mathbf{y}_{12} \ge \mathbf{x}_1 - \mathbf{x}_2 \\ \mathbf{y}_{12} \ge -\mathbf{x}_1 + \mathbf{x}_2 \\ \mathbf{y}_{14} \le \mathbf{x}_1 + \mathbf{x}_4 \\ \mathbf{y}_{14} \le 2 - \mathbf{x}_1 - \mathbf{x}_4 \\ \mathbf{y}_{14} \ge \mathbf{x}_1 - \mathbf{x}_4 \\ \mathbf{y}_{14} \ge -\mathbf{x}_1 + \mathbf{x}_4 \\ \mathbf{y}_{23} \le \mathbf{x}_2 + \mathbf{x}_3 \\ \mathbf{y}_{23} \le 2 - \mathbf{x}_2 - \mathbf{x}_3 \\ \mathbf{y}_{23} \ge \mathbf{x}_2 - \mathbf{x}_3 \\ \mathbf{y}_{23} \ge -\mathbf{x}_2 + \mathbf{x}_3 \\ \mathbf{y}_{35} \le \mathbf{x}_3 + \mathbf{x}_5 \\ \mathbf{y}_{35} \le 2 - \mathbf{x}_3 - \mathbf{x}_5 \\ \mathbf{y}_{35} \ge \mathbf{x}_3 - \mathbf{x}_5 \\ \mathbf{y}_{35} \ge -\mathbf{x}_3 + \mathbf{x}_5 \\ \mathbf{y}_{45} \le \mathbf{x}_4 + \mathbf{x}_5 \\ \mathbf{y}_{45} \le 2 - \mathbf{x}_4 - \mathbf{x}_5 \\ \mathbf{y}_{45} \ge \mathbf{x}_4 - \mathbf{x}_5 \\ \mathbf{y}_{45} \ge -\mathbf{x}_4 + \mathbf{x}_5 Each :math:`\mathbf{x}, \mathbf{y}\in \{0, 1\}`. This ILP formulation ensures that :math:`\mathbf{y}_{ij} = 1` if and only if nodes :math:`i` and :math:`j` belong to different subsets (i.e., edge :math:`(i,j)` is cut). **We provide general ILP formulation of graph maxcut** .. raw:: html