Formulate constraint as conditional sum

(Giacomo Falchetta) #1

Dear all,

I am using CVXR (i.e. the R package to solve CVX problems). In particular, I am trying to translate a constrained optimisation problem that I have successfully formulated and solved with the Excel Solver.

In particular, my problem reads as:

min sum(x)

s.t.
k(y) > 0.9

where:
x = Int(5) [integer variable with 5 observations]
y(x) = x/3
k(y) = sum(values of values of y that are <3)/100

How do I formulate it in CVX (CVXR)?

Thanks.

(Mark L. Stone) #2

This forum addresses CVX, which runs under MATLAB. It does not address CVXR, which is a different package than CVX, and which runs under R.

In either case, i recommend you read the documentation, which for CVX is at http://cvxr.com/cvx/doc/. To handle the conditional nature of the argument of sum in k(y), you can do Big M modeling along the lines of https://or.stackexchange.com/questions/76/in-an-integer-program-how-can-i-activate-a-constraint-only-if-a-decision-vari .