Mixing constants, floats and boolean in one variable

61 views
Skip to first unread message

Tobias Pfingsten

unread,
Jun 17, 2021, 4:29:11 AM6/17/21
to cvxpy
Dear CVXPY community


first of all thanks for the great package! I love using it.

In my problem setup I would like to stick to a formulation such as A @ x<= b, where x is a Variable with size n. However, the variable x may consist of constants, floats or binary variables (depending on problem parametrization).

Is there a way of defining single elements of x to be constant or binary? E.g.
x[10] = cp.Variable(1, boolean=True)

or collecting several variables in a vector that still allows for the above expression A@x<=b, such as
x = [cp.Variable(1), cp.Variable(1, boolean=True), cp.Constant(1, value = 3.)] ?

Thank you a lot, 
Tobias
Reply all
Reply to author
Forward
0 new messages