I am trying to prevent a single stock from holding both a long and a short position (i.e., yp > 0 and yn < 0 simultaneously) within a pure conic (LP/QP/SOCP) model—without introducing binary variables, which turn the problem into MILO and become too slow for our daily re-balance.
All continuous penalties or hard bounds on min(yp, -yn) still leave O(1e-4) dual footprints.
Has anyone found a conic-compatible trick (special cones, perspective formulations, etc.) that exactly eliminates these simultaneous long/short residuals, or is the MILP route the only rigorous way?
Any suggestions or references would be greatly appreciated!
Remark
In a long-short portfolio optimization, we model the position `y` of each stock as the difference between a long leg `yp ≥ 0` and a short leg `yn ≤ 0`:
```
y = yp + yn
```
We want **the same stock to be either long or short, but never both** (no “dual position”).
Introducing binary variables (`bup`, `bun`) works but turns the model into MILO and becomes **too slow** for daily rebalancing.
Hence we need a **conic (LP/QP/SOCP) compatible way** to **penalise or strictly forbid** `yp > 0` **and** `yn < 0` **simultaneously** for the **same asset**, **without binaries**.
---
**Tiny Data Example**
| Stock | yp (long) | yn (short) | y = yp + yn | min(yp, -yn) |
|-------|-----------|------------|-------------|--------------|
| AAPL | 0.04 | -0.01 | 0.03 | 0.01 | ← dual position
| MSFT | 0.05 | 0.00 | 0.05 | 0.00 | ← clean long
| TSLA | 0.00 | -0.03 | -0.03 | 0.00 | ← clean short
We want the **0.01** in the last column to be **exactly zero** (or numerically ≤ 1e-6).
---
**Conic-compatible attempts discussed & why they failed**
1. **Linear penalty on auxiliary `z = min(yp, -yn)`**
- Constraints: `z ≤ yp`, `z ≤ -yn`
- Objective: `maximize … − λ·Σz`
- Result: `z` is **allowed to be 0**; optimiser sets `z = 0` while **keeping both yp and yn small but positive**, so **dual positions remain** (visible at 1e-4 level).
- λ raised to 1e5 still leaves residuals ≈ 2e-4.
2. **Hard upper-bound `z ≤ ε`**
- Adds `z ≤ 1e-6` linear constraint.
- Numerically **does not force** `min(yp, -yn) ≤ ε`; it only forces **z ≤ ε**, and again **z = 0** is feasible, so **same stock can still have both legs > 0**.
3. **Second-order cone `sqrt(yp² + yn²) ≤ t` with `t ≤ 1e-6`**
- Forces **at least one leg to be ≤ 1e-6**, but **does not guarantee the other leg is zero**;
- In practice **both legs remain at 1e-6 level**, still a **dual position** after rounding.
4. **Rotated-cone CVaR constraint**
- Equivalent to a weighted sum of `z`; same issue as 1 & 2: **z can be set to 0 without squeezing both yp and yn to zero**.