1 | initial version |
You program is minimizing y above those lines. The problem is not unbounded only because of the additional constraints 0 < p < 1 given by the top 2 rows of G (=see below).
Using the notation in the article you linked, linear_program(c,G,h) minimizes c * x given G * x < h. You have c=[0,1], so you are minimizing y. You want c=[0,-1].
You have G * x = [-p,p,-p-y,-3p-y] < h, which gives y>-h[2]-p, y>-h[3]-3p. You want G*x=[-p,p,p+y,3p+y] and h=[0,1,1,2].
So you want c=[0,-1]; G=[[-1,0],[1,0],[1,1],[3,1]]; h=[0,1,1,2]. As for M, I have no clue what it is.
2 | No.2 Revision |
You program is minimizing y above those lines. The problem is not unbounded only because of the additional constraints 0 < p < 1 given by the top 2 rows of G (=see below).
Using the notation in the article you linked, linear_program(c,G,h) minimizes c * x given G * x < h. You have c=[0,1], c=[0,1] and x=[p,y], so you are minimizing y. You want c=[0,-1].
You have G * x = [-p,p,-p-y,-3p-y] < h, which gives y>-h[2]-p, y>-h[3]-3p. You want G*x=[-p,p,p+y,3p+y] and h=[0,1,1,2].
So you want c=[0,-1]; G=[[-1,0],[1,0],[1,1],[3,1]]; h=[0,1,1,2]. As for M, I have no clue what it is.
3 | No.3 Revision |
You program is minimizing y above those lines. The problem is not unbounded only because of the additional constraints 0 < p < 1 given by the top 2 rows of G (=see below).
Using the notation in the article you linked, linear_program(c,G,h) minimizes c * x given G * x < h. You have c=[0,1] and x=[p,y], so you are minimizing y. You want c=[0,-1].
You have G * x = [-p,p,-p-y,-3p-y] < h, which gives y>-h[2]-p, y>-h[3]-3p. You want G*x=[-p,p,p+y,3p+y] and h=[0,1,1,2].
So you want c=[0,-1]; G=[[-1,0],[1,0],[1,1],[3,1]]; h=[0,1,1,2]. As for M, I have no clue what it is.
linear_program(vector([0,-1]),matrix([[-1,0],[1,0],[1,1],[3,1]]),vector([0,1,1,2]))['x'][0]
-7.08356432755e-09