You can use the bounds
parameter of PortfolioOptimization
. By default, bounds = None
, which assume that all variables x_i
are binaries.
If you want to release the constrain, you can set bounds = [(x_1_min, x_1_max), (x_2_min, x_2_max), ...]
where x_i_max
/x_i_min
is the upper/lower bound of x_i
, and the length of the list has to equal to the number of variable. If all variables share the same upper bound, you can simplify the input as bounds = [(x_lower_bound, x_upper_bound)] * num_variable
.
Example:
x_lower_bound = 0
x_upper_bound = budget
num_variable = 4
portfolio = PortfolioOptimization(expected_return, covariance, risk_factor, budget, bounds=[(x_lower_bound, x_upper_bound)] * num_variable)