Ask Your Question
0

Pedagogical Fourier Motzkin

asked 2020-09-13 22:56:52 -0500

Cyrille gravatar image

I want to decompose Fourier-Motzkin algorithm for educational reasons. Suppose I have

z_1=solve(4*x_2<=100,x_2)[0][0]
z_2=solve(-35*x_2<=-3,x_2)[0][0]
z_3=solve(12*x_2 <= 72,x_2)[0][0]
z_4=solve(1-1*x_2 <= 40,x_2)[0][0]
show(z_1,",   ",z_2,",   ",z_3,",   ",z_4)

How coud I select the z_i according to the inequality sign and construct 2 sets.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2020-09-14 03:07:20 -0500

tmonteil gravatar image

updated 2020-09-14 04:27:34 -0500

Your data give:

sage: z_1                                                                                                                                                                                                    
x_2 <= 25
sage: z_2                                                                                                                                                                                                    
x_2 >= (3/35)

You can look at the operator of the symbolic expression as follows:

sage: z_1.operator()                                                                                                                                                                                         
<built-in function le>
sage: z_2.operator()                                                                                                                                                                                         
<built-in function ge>

You can recognize which operator it is as follows:

sage: z_1.operator() is operator.le                                                                                                                                                                          
True
sage: z_1.operator() is operator.ge                                                                                                                                                                          
False
sage: z_2.operator() is operator.le                                                                                                                                                                          
False
sage: z_2.operator() is operator.ge                                                                                                                                                                          
True

le stands for "less or equal than" and ge stands for "greater or equal than".

edit flag offensive delete link more

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: 2020-09-13 22:56:52 -0500

Seen: 42 times

Last updated: Sep 14