我试图在 CVXPY 中声明一个变量,这个变量是其他两个变量之间某些操作的结果。我的问题是当我尝试计算 CVXPY 的两个最大对象之间的差异时,它显示“问题不遵循 DCP 规则”我可以计算差异吗?可能存在另一种方式吗?
import cvxpy as cvx
#_asig_f1_qdc = Matrix 20x20
#_asig_f1_nom = Matrix 20x20
#_asig_f1_nom = Matrix 20x20
#_custos = len 20
#_prices = len 20
x = cvx.Variable( len(ind_decisoes1), nonneg=True ) # Len = 20
qdc = cvx.Variable( len(ind_decisoes1), nonneg=True ) # Len = 20
_volume_sr_f1 = cvx.pos( _asig_f1_nom @ x - _asig_f1_qdc @ qdc )
_volume_sr_f1_2 = cvx.pos(cvx.pos( _asig_f1_nom @ x - _asig_f1_qdc @ qdc ) - _vol_f1_qdc @ qdc)
_volume = _volume_sr_f1 - _volume_sr_f1_2
objective = cvx.Minimize( _prices @ x + _custos @ _volume )