cvxgrp / CVXR

An R modeling language for convex optimization problems.

Home Page:https://cvxr.rbind.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to solve a problem with a paarameter in it?

opened this issue · comments

Hi,
In Python I could have the constraint depend on a parameter that is supplied later on.

param = cp.Parameter(nonneg=True)
prob = cp.Problem(cp.Minimize(y), [x == param])
param.value = 3
prob.solve()

How can I achieve this in R? I tried using the Parameter class and then setting the param value by calling value(param) <- 3 but solve didn't work.

Reference semantics in effect for Parameter