Ask Your Question
0

Finding an assignment that satisfies a set of inequalities

asked 2016-03-13 09:59:52 +0100

Erel Segal-Halevi gravatar image

I have the following simple set of inequalities:

var('x,y')
assume(x,'integer')
assume(y,'integer')
assume(x>0)
assume(y>0)
ineq = [x<y, y<3]

I would like to find an assignment that satisfies this set of inequalities. In this case there is one such assignment:

x=1, y=2

In general there may be many assignments; I only need to find one. Is there a way to do this in SageMath?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-03-13 11:57:36 +0100

tmonteil gravatar image

Since your equations are linear, and your constraints about the variables is that they are integer, i strongly suggest to look at linear programming in Sage:

Do not hesitate to ask for more details if something is not clear (with your attempts so that we can discuss them).

edit flag offensive delete link more

Comments

I read the manual about linear programming, but, apparently it talks about maximization problems. I am not interested in maximization - I only want to find a single assignment that satisfies the inequalities. Can you show me how to solve a simple example, e.g, "find x and y such that x<y and y<3"?

Erel Segal-Halevi gravatar imageErel Segal-Halevi ( 2016-06-23 12:21:34 +0100 )edit

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-03-13 09:59:52 +0100

Seen: 373 times

Last updated: Mar 13 '16