Ask Your Question
0

Why do I get the "unable to find a common ring for all elements" error message?

asked 11 years ago

Behzad gravatar image

I was wondering if you can take a look at this cell:

http://sagecell.sagemath.org/?q=ypqhgw

and let me know why I get the error message.

Thanks

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 11 years ago

ppurka gravatar image

The variables in the MILP are not symbolic variables, i.e., not from the Symbolic Ring. The vector() command is failing in that step.

type(x)
<type 'sage.numerical.linear_functions.LinearFunction'>

You can rewrite your constraints like this

p.add_constraint(sum(_a*_x for _a,_x in zip(a1, [x,y])) + r*a1.norm(2) <= b1)
Preview: (hide)
link

Comments

Basically, you are reimplementing the dot product. That seems like a "bad thing". Obviously linear algebra and linear programming should play well together - can this actually be done?

Saul Schleimer gravatar imageSaul Schleimer ( 9 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 11 years ago

Seen: 2,147 times

Last updated: Nov 17 '13