Can I restrict variable to only a few values?


How should I write in CVX if a variable x can only take value in \{0.001, 0.01, 0.1\}?

Is this model possible in CVX (putting soft constraint as an energy term?)?
(Mark L. Stone) #2

x is an expression which can take the values 0.001, 0.01, or 0.1

variable b(2) binary
x = 0.001 + 0.009*b(1) + 0.099*b(2)
sum(b) <= 1


It works.
Thank you for your help.