SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Algorithm 4 Pseudocode for learning linear surrogates with LANCER-prior (used in section 5.2.2): we learn  $\mathbf{c}_{\theta}$  on a distribution of optimization problems. Note that  $\mathbf{y} = \mathbf{z}$  in this setting
1: Input:  $\mathcal{D}_{\mathrm{train}}\gets \{\mathbf{y}_i\}_{i = 1}^N$  , solver g, objective  $f$  (can be black-box), target model  $\mathbf{c}_{\theta}$    
2: Initialize  $\mathbf{c}_{\theta}$  (random, warm start from heuristics);   
3: Set  $\mathcal{D}\gets \{\}$  .   
4: for  $t = 1\dots T$  do   
5: w-step (fix  $\pmb{\theta}$  and optimize over w):   
6: for  $(\mathbf{y}_i)\in \mathcal{D}_{\mathrm{train}}$  do   
7: evaluate  $\hat{\mathbf{c}}_i = \mathbf{c}_{\theta}(\mathbf{y}_i)$    
8: evaluate  $\hat{f}_i = f(\mathbf{g}(\hat{\mathbf{c}}_i);\mathbf{y}_i)$    
9: add  $(\hat{\mathbf{c}}_i,\mathbf{y}_i,\hat{f}_i)$  to  $\mathcal{D}$    
10: end for   
11: minimize: minw  $\sum_{j\in \mathcal{D}}\left\| \mathcal{M}_{\mathrm{w}}(\hat{\mathbf{c}}_j,\mathbf{y}_j) - \hat{f}_j\right\|$    
12:  $\pmb{\theta}$  step (fix w and optimize over  $\pmb{\theta}$  ..   
13: minimize: mino  $\sum_{i\in \mathcal{D}_{\mathrm{train}}}\mathcal{M}_{\mathrm{w}}(\mathbf{c}_{\theta}(\mathbf{y}_i),\mathbf{y}_i)$    
14: end for
C Details of experimental setup
C.1 Synthetic data
C.1.1 Combinatorial optimization with linear objective
Data We follow the setup and scripts from PyEPO [38] library to generate data.
- For SP, we follow the same data generation process as in the original scripts:  $5 \times 5$  grid (40 total edges), 1000 training problem instances with 5 input features (i.e.,  $Y \in \mathbb{R}^{1000 \times 5}$ ) and the same for the test set. Input features ( $\mathbf{y}$ ) are generated using normal distribution with  $\mathcal{N}(\mathbf{0}, \mathbf{1})$ . The ground truth descriptors  $\mathbf{z}$  are obtained by first randomly and linearly projecting  $\mathbf{y}$  in 40 dimensions followed by nonlinearity (polynomial of degree 6 and normalization). Lastly, random noise is added to  $\mathbf{z}$  to make the problem harder. We use the standard linear program (LP) formulation of the shortest path and implement solver  $\mathbf{g}$  in SCIP [1].
- As for MKS, we begin by generating a cost vector for each item using a random uniform distribution between 0 and 5. Then, we obtain features  $\mathbf{y}$  by passing  $\mathbf{z}$  through a random neural network with one hidden layer of size 500 and tanh activation. Knapsack capacity is 40, knapsack dimension is 5, 100 total items to choose from, feature dimension is 256 and there are 1000 instances in both train/test. Lastly, weight for each item is generated
according to the uniform distribution between 0 and 1. We use the standard mixed-integer linear program (MILP) formulation of the multidimensional knapsack and implement solvers in SCIP [1].
Target mapping  $c_{\theta}$  All baselines use the same target mappings for each problem: linear mapping for SP and MLP with 1 hidden layer for MKS (size of 300 and tanh activation).
LANCER The training procedure closely follows Algorithm 2. Other problem dependent settings are as follows:
- For SP, LANCER uses MLP with 2 hidden layers of size 100 (tanh activation). We train LANCER for  $T = 10$  iterations. At each iteration, we make 5 updates (using Adam optimizer with lr=0.001) for each mappings ( $c_{\theta}$  and  $\mathcal{M}_{\mathbf{w}}$ ).
- For MKS, LANCER uses MLP with 2 hidden layers of size 200 (tanh activation). We train LANCER for  $T = 7$  iterations. At each iteration, we perform 5 updates (using Adam optimizer with lr=0.001) for  $\mathbf{c}_{\theta}$  and 10 updates for  $\mathcal{M}_{\mathbf{w}}$ .
- SPO+, DBB: We use the versions implemented within PyEPO and set the number of epochs to 25. Both methods use the Adam optimizer with learning rates tuned for each problem. Other arguments follow the default setting suggested by authors.
- LODLs: We use the implementation provided by authors in [37]. We set the number of sampling points to 1000 and employ "random Hessian" version of the algorithm. Other arguments follow the default setting suggested by authors.
C.1.2 Combinatorial optimization with nonlinear objective
We aim to solve the following optimization problem with nonlinear objective:
$$
\min  _ {\mathbf {x}} \Phi \left(\left(W - \sum_ {(u, v) \in E} x _ {u, v} \mu_ {u, v}\right) / \sqrt {\sum_ {(u , v) \in E} x _ {u , v} \sigma_ {u , v}}\right)
$$
s.t.  $\sum_{(u,t)\in E}x_{u,t}\geq 1$  (at least one unit of flow into  $t$ ) (5)
$$
\begin{array}{l} \sum_ {u: (u, v) \in E} x _ {u, t} - \sum_ {u: (v, u) \in E} x _ {u, t} \geq 0, \quad \forall v \notin \{s, t \} \quad (\text {f l o w i n} \geq \text {f l o w o u t}) \\ \mathbf {x} \geq 0 \\ \end{array}
$$
where  $\Phi$  is the standard Gaussian cumulative distribution function (CDF),  $E$  is the set of all edges,  $W$  is the user-defined threshold,  $\mu_{u,v}$  and  $\sigma_{u,v}$  are the mean and the variance of the corresponding edge's weight.
Data We closely follow the data generation process described in [16]. Specifically, each edge is a random variable with  $\mu$  coming from the uniform distribution (between 0.1 and 0.2); and with  $\sigma$  is also generated uniformly randomly (between 0.1 and 0.3 multiplied by  $1 - \mu$ ). For thresholds  $W$ , we set them as follows: calculate the distance of the shortest path distance using the mean value as an edge weight and multiply it to 0.9 for tight, 1.0 for normal and 1.1 for loose deadlines, respectively. We set the number of problem instances to 25 and use the Bellman-Ford algorithm for a solver  $\mathbf{g}$ .
LANCER The training procedure closely follows Algorithm 3. We use MLP with 2 hidden layers of size 200 (300 for  $15 \times 15$  grid size) and tanh activation. We train LANCER for  $T = 40$  iterations. At each iteration, we make 10 updates (using Adam optimizer) for each learnable models ( $\mathbf{c}$  and  $\mathcal{M}_{\mathbf{w}}$ ).
- SCIP attempts to solve the original MINLP defined in Eqn. (5). We set the maximum time limit to  $30\mathrm{min}$  before terminating the solver.
- Domain Heuristic simply assigns each edge's weight as  $w_{e} = \mu_{e} + \gamma \sigma_{e}$  (where  $\gamma$  is a hyperparameter) and run the Bellman-Ford's algorithm.
- SurCo [16] replicates the same experimental setup as described in the original paper. Specifically, we use DBB [34] to differentiate through the solver with  $\lambda = 1000$  and apply Adam optimizer for 40 epochs with the learning rate  $= 0.1$ .
C.2 Real-world use case: quadratic and broader nonlinear portfolio selection
C.2.1 The quadratic programming (QP) formulation
We use the standard quadratic program formulation of the Markowitz' [30] portfolio selection problem:
$$
\min  _ {\mathbf {x}} \alpha \mathbf {x} ^ {T} \mathbf {G} \mathbf {x} - \boldsymbol {\mu} ^ {T} \mathbf {x}
$$
$$
s. t. \quad \sum_ {i = 1} ^ {k} x _ {i} = 1 \quad \text {a n d} \quad \mathbf {x} \geq 0 \tag {6}
$$
where  $\mu$  is an expected return vector for each portfolio and  $\mathbf{G}$  is the covariance matrix. We set the user-defined hyperparameter  $\alpha = 0.1$  in all experiments and use CvxPy [10] to solve QP in eq. (6).
Data We reuse the code from Shah et al. [37] to generate data (downloaded from QuandlWIKI [35]) and use the same setup. The features  $\mathbf{y}$  are historical stock prices and the task is to predict an expected return  $\mu$  (using MLP with 1 hidden layer of size 500) in smart Predict+Optimize fashion. There are 200 instances in train/validation set and 400 instances in test set. The number of portfolios in each instance is 50.
LANCER The training procedure closely follows Algorithm 2. We use MLP with 2 hidden layers of size 100 and tanh activation. We train LANCER for  $T = 8$  iterations. At each iteration, we make 10 updates (using Adam optimizer) to fit each mapping  $(\mathbf{c}_{\theta}$  and  $\mathcal{M}_{\mathbf{w}})$ .
- LODLs: We use the implementation provided by authors in [37]. We replicate their configurations for this experiment, except we made a quick fix in the code as they forgot to add a matrix transpose in the quadratic term.
- MDFL (Melding Decision Focused Learning) [41]: we use the version implemented in [37] and follow their configurations.
C.2.2 Combinatorial portfolio selection with third-order objective
We extend the portfolio selection problem in eq. (6) as follows:
$$
\begin{array}{l} \min  _ {\mathbf {x}, \mathbf {v}} \alpha \mathbf {x} ^ {T} \mathbf {G} \mathbf {x} + \gamma \| \mathbf {x} - \mathbf {x} _ {0} \| _ {1} - \boldsymbol {\mu} ^ {T} \mathbf {x} - \beta \mathbf {x} ^ {T} \mathbf {S} \mathbf {x} \otimes \mathbf {x} \\ \text {s . t .} \quad \sum_ {i = 1} ^ {k} x _ {i} = 1 \\ f _ {\min } * v _ {i} \leq x _ {i} \leq f _ {\max } * v _ {i} \quad \text {f o r} \quad i = 1 \dots k \quad (\text {f r a c t i o n o f e a c h s e l e c t e d p o r t f o l i o}) \tag {7} \\ m \leq \sum_ {i = 1} ^ {k} v _ {i} \leq M \quad (\text {n o . o f s e l e c t e d p o r t f o l i o s m u s t b e b e t w e e n m a n d} M) \\ \mathbf {x} \geq 0 \\ \mathbf {v} \in \{0, 1 \} \\ \end{array}
$$
where  $\mathbf{S}$  is co-skewness matrix and  $\mathbf{v}$  is the binary variables to enforce discrete constraints (e.g. hard limit on number of portfolios). We also introduce the initial portfolio selection vector  $\mathbf{x}_0$  (generated uniformly at random) and enforce our final solution to be close to it (via  $\gamma$ ). We set the penalty on co-skewness as  $\beta = 0.5$ ,  $\gamma = 0.01$ ,  $m = 3$ ,  $M = 10$ ,  $f_{\mathrm{min}} = 0.01$  and  $f_{\mathrm{max}} = 0.2$  throughout all
experiments. We reuse the same data as in section C.2.1 but increase the number of portfolios to 100 and add co-skewness matrix  $\mathbf{S}$  to it. Note that in this task we assume that all problem descriptors are fully observed (e.g.  $\mu, \mathbf{G}, \mathbf{S}$ ).
LANCER The training procedure for LANCER-zero closely follows Algorithm 3 and LANCER-prior closely follows Algorithm 4. We use MLP with 2 hidden layers of size 300 and tanh activation. We train LANCER for  $T = 40$  iterations. At each iteration, we perform 10 updates (using Adam optimizer) for each learnable models ( $\mathbf{c}_{\theta}$  and  $\mathcal{M}\mathbf{w}$ ). Additionally, LANCER-prior uses a parametric mapping for  $\mathbf{c}_{\theta}$  which is implemented via 1 hidden layer MLP of size 500, which  $\mu$  takes as input.
- SCIP attempts to solve the problem defined in Eqn. (7) in three different settings related to the objective: ignores all nonlinear terms (MILP), ignores cubic term (MIQP) and attempts to solve the original nonlinear problem (MINLP). We set the maximum time limit to  $60\mathrm{min}$  before terminating the solver and obtaining the best solution.
- For SurCo [16], we use two versions: SurCo-prior and SurCo-zero. SurCo-prior uses the same mapping for  $\mathbf{c}_{\theta}$  as LANCER described above. We use DBB [34] to differentiate through the solver with  $\lambda = 100$  and apply Adam optimizer for 100 epochs with the learning rate  $= 0.1$  (0.0001 for prior).
D Combinatorial portfolio selection with third-order objective
Based on our experimental findings, LANCER showcased the most significant improvement in addressing the combinatorial portfolio selection problem. Inspired by this success, we delved further into the intricacies of this problem and sought to visualize the actual solutions obtained by the two best-performing methods: SurCo and LANCER. We present the results for a randomly selected instance in Figure 6.
We have assigned a symbol of a corresponding S&P company to each point for clarity. On the Y-axis, we represent the expected return of a selected stock, which is multiplied by its fraction (approximate solution  $\mathbf{x}$  in Eqn. (7)). Similarly, the X-axis displays the "risk-skewness score" calculated as follows:  $\alpha \mathbf{x} \odot (\mathbf{G}\mathbf{x}) - \beta \mathbf{x} \odot (\mathbf{S}\mathbf{x} \otimes \mathbf{x})$ , where  $\odot$  denotes element-wise multiplication. This computation results in a vector of dimensions equal to the number of stocks, enabling us to interpret it as a score assigned to each stock. Furthermore, the combinatorial constraints outlined in Eqn. (7) enforce the selection of a maximum of  $M$  stocks with fractions lower than or equal to  $f_{\mathrm{max}}$ .
As we try to maximize the return and minimize the risk-skewness score, we want all points to be in the upper-left corner. This is what LANCER achieves. It is interesting to see that LANCER chooses the less number of portfolios (6 vs 9) but assigns higher fraction to them improving overall objective.
E Stability of LANCER
Similar to many other approaches designed for solving problems with bi-level optimizations, including actor-critic algorithms, we currently lack theoretical guarantees regarding the convergence of LANCER with respect to either  $\mathcal{M}_{\mathrm{w}}$  or  $c_{\theta}$ . This lack of guarantees can also impact the stability of the algorithm. However, this is primarily a matter that can be addressed through empirical investigation and depends on various factors, which is typical in the process of model selection. Nevertheless, we have observed that LANCER generally exhibits robustness in many cases. As an evidence, we performed additional experiments on nonlinear shortest path problem (section 5.1.2). In the two tables below we demonstrate that the final objective does not fluctuate significantly when we experiment with different combinations of hyperparameters and variations of neural net architecture. We will leave more ablation studies as the future work.
Figure 6: Visualization of the solution for a single instance of the combinatorial portfolio selection with third-order objective. LANCER demonstrates a tendency to select and allocate a significant proportion to stocks characterized by a combination of low 'risk - skewness' and high rewards (upper-left corner).
Table 4: Exploring various hyperparameters for LANCER for nonlinear shortest path problem from section 5.1.2.
Mw lnr_rate	Mw max itr	cθ lnr_rate	cθ max itr	OBJECTIVE
0.0005	10	0.001	10	0.4651
0.001	10	0.001	10	0.4649
0.01	10	0.001	10	0.4650
0.0005	5	0.001	10	0.4590
0.001	5	0.001	10	0.4597
0.01	5	0.001	10	0.4651
0.0005	20	0.001	10	0.4651
0.001	20	0.001	10	0.4612
0.01	20	0.001	10	0.4651
0.001	10	0.0005	10	0.4612
0.001	10	0.01	10	0.4650
0.001	10	0.001	20	0.4648
Table 5: Exploring various model architecture for LANCER for nonlinear shortest path problem from section 5.1.2.
Mw num of hidden layers	Mw layer size	OBJECTIVE
1	50	0.4644
1	100	0.4646
1	200	0.4641
2	50	0.4646
2	100	0.4651
2	200	0.4651
3	50	0.4644
3	100	0.4650
3	200	0.4642