Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converting Stocks from Integer to Real #20

Open
ab-jiteshlalwani opened this issue Sep 17, 2022 · 0 comments
Open

Converting Stocks from Integer to Real #20

ab-jiteshlalwani opened this issue Sep 17, 2022 · 0 comments

Comments

@ab-jiteshlalwani
Copy link

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:

x = {s: Integer("%s" %s, lower_bound=0,

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:

risk = risk + coeff*x[s1]*x[s2]

Is there any way to solve the error and get real values in output i.e. in decimals?

@ab-jiteshlalwani ab-jiteshlalwani changed the title Converting Stocks from Interger to Real Converting Stocks from Integer to Real Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant