You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are working on an application that requires d-wave to return real values instead of integers, so we are trying to modify the code so that we can get stocks = 1.5 instead of 2. Here is what happens when we change the following code:
x = {s: dimod.Integer("%s" % s, lower_bound=0,
upper_bound=self.max_num_shares[s]) for s in self.stocks}
to
x = {s: dimod.Real("%s" % s, lower_bound=0,
upper_bound=self.max_num_shares[s]) for s in self.stocks}
We are working on an application that requires d-wave to return real values instead of integers, so we are trying to modify the code so that we can get stocks = 1.5 instead of 2. Here is what happens when we change the following code:
x = {s: dimod.Integer("%s" % s, lower_bound=0,
upper_bound=self.max_num_shares[s]) for s in self.stocks}
to
x = {s: dimod.Real("%s" % s, lower_bound=0,
upper_bound=self.max_num_shares[s]) for s in self.stocks}
Reference:
portfolio-optimization/single_period.py
Line 209 in 503640b
We are getting the below error:
ValueError: REAL variables (e.g. 'ACS.MC') cannot have interactions
for line: risk = risk + coeff * x[s1] * x[s2]
Reference:
portfolio-optimization/single_period.py
Line 216 in 503640b
Is there any way to solve the error and get real values in output i.e. in decimals?
The text was updated successfully, but these errors were encountered: