Python: How to find out values of all feasible x under constraints.

Xiang Zhang zhangxiangsunny at gmail.com
Thu May 14 23:58:48 EDT 2015


Dear all,

I am writing a code using Python now.

I want to know how to find out values of all feasible x under constraints.

x = [x_1, x_2, x_3,..., x_10]


constraints:
x_i = 0,1,2,3 or 4,          where i=1,2,....10
x_1 + x_2 + x_3 +...+x_10 <= 15

How to find out all the feasible solutions x (domain of x) using python, like [0,0,0,0,0,0,0,0,0,0], [1,1,1,1,1,1,1,1,1,1] etc ? What should be the code?

Any hint or help would be highly appreciated!

Sincerely,

Xiang Zhang



More information about the Python-list mailing list