XiongPengNUS / rsome

Robust Stochastic Optimization Made Easy
GNU General Public License v3.0
282 stars 54 forks source link

Sum square of affine expressions - aro #59

Closed GalPerelman closed 3 months ago

GalPerelman commented 4 months ago

Is there a way to use rsome.sumsqr or rsome.square with ldr variables?

For example, consider the following:

import rsome
from rsome import ro

model = ro.Model()

x = model.ldr((n, T))
z = model.rvar((n, T))
uset = (rsome.norm(z.reshape(-1), 2) <= 1)

for t in range(1, T):
    x[:, t].adapt(z[:, :t])

model.minmax(rsome.sumsquare(c * x), nom_uset)

This code raises the following error: AttributeError: 'RoAffine' object has no attribute 'square'

Alternatively, does ROSME allow the definition of gurobi SOS constraints?

The purpose of these questions is to model a quadratic objective function for adjustable robust optimization problem In case squared ldr variables are not available the second option is to model a piecewise linear objective by using SOS constraints

XiongPengNUS commented 3 months ago

Hi @GalPerelman, unfortunately, RSOME does not support the square or norm of expressions involving linear decision rule or random variables. Please check the general RO formulation discussed at here, the objective function or constraints must be biaffine in the decision variable $\pmb{x}$ and random variable $\pmb{z}$, so that we can reformulate the robust model into its tractable deterministic equivalence. Squares or any other nonlinear operations do not comply with this general format so in general, there is no easy way to support them in RSOME.