# Linear Programming / Simplex, and Stock Options | How to Set up Problem

Good morning,

I found an article online, which I thought would be fun to play along with, and replicate the results
that the author got. However, I can't seem to figure out how he set up how his problem.

http://www.durangobill.com/LP_Options.html

the gist of the article is that if you owned a brokerage firm (I don't), its possible to create a basket of stock option combinations that will guarantee profit regardless of how the underlying security moves.

``````Maximize p = x13
s.t.

- 1500x1 - 1130x2 - 1020x3 + 1500x4 + 1130x5 + 1020x6 + 56920x7 + 57200x8 + 57450x9 - 56920x10 - 57200x11 - 57450x12 - 1x13 >= 0
- 1500x1 - 1130x2 - 1020x3 + 1500x4 + 1130x5 + 1020x6 + 920x7 + 1200x8 + 1450x9 - 920x10 - 1200x11 - 1450x12 - 1x13 >= 0
- 1000x1 - 1130x2 - 1020x3 + 1000x4 + 1130x5 + 1020x6 - 1080x7 - 1300x8 - 1050x9 + 1080x10 + 1300x11 + 1050x12 - 1x13 >= 0
+ 1500x1 + 1370x2 + 980x3 - 1500x4 - 1370x5 - 980x6 - 1080x7 - 1300x8 - 1550x9 + 1080x10 + 1300x11 + 1550x12 - 1x13 >= 0
+ 40500x1 + 40370x2 + 39980x3 - 40500x4 - 40370x5 - 39980x6 - 1080x7 - 1300x8 - 1550x9 + 1080x10 + 1300x11 + 1550x12 - 1x13 >= 0
+ 1x1 + 1x2 + 1x3 + 1x4 + 1x5 + 1x6 + 1x7 + 1x8 + 1x9 + 1x10 + 1x11 + 1x12 - 0x13 <= 1
+ 1x1 + 1x2 + 1x3 + 1x4 + 1x5 + 1x6 + 1x7 + 1x8 + 1x9 + 1x10 + 1x11 + 1x12 - 0x13 >=1
``````

for the life of me, I can't get my head wrapped around how to set this up.
I can't think of how to set it up in excel for solver

I've tried dumping it as is into this web site which has a  JS solver utility, and it bombs out.
:http://www.zweigmedia.com/RealWorld/simplex.html

Any help is super appreciated.
thanks
-JW
Programming Languages-OtherProgrammingMath / Science

Last Comment
GwynforWeb

8/22/2022 - Mon

The problem is specified in AMPL (http://en.wikipedia.org/wiki/AMPL).  So just you need to get a linear programming solver.
GwynforWeb

Your solver is fussy about the format at start of each equation. I got it to "work" for below but basically the problem is too big. You need to find a better solver. You may have to download one. All the online ones are the same code as far as I can see.

Maximize p = x13 subject to

-1500x1 - 1130x2 - 1020x3 + 1500x4 + 1130x5 + 1020x6 + 56920x7 + 57200x8 + 57450x9 - 56920x10 - 57200x11 - 57450x12 - 1x13 >= 0
-1500x1 - 1130x2 - 1020x3 + 1500x4 + 1130x5 + 1020x6 + 920x7 + 1200x8 + 1450x9 - 920x10 - 1200x11 - 1450x12 - 1x13 >= 0
-1000x1 - 1130x2 - 1020x3 + 1000x4 + 1130x5 + 1020x6 - 1080x7 - 1300x8 - 1050x9 + 1080x10 + 1300x11 + 1050x12 - 1x13 >= 0
1500x1 + 1370x2 + 980x3 - 1500x4 - 1370x5 - 980x6 - 1080x7 - 1300x8 - 1550x9 + 1080x10 + 1300x11 + 1550x12 - 1x13 >= 0
40500x1 + 40370x2 + 39980x3 - 40500x4 - 40370x5 - 39980x6 - 1080x7 - 1300x8 - 1550x9 + 1080x10 + 1300x11 + 1550x12 - 1x13 >= 0
1x1 + 1x2 + 1x3 + 1x4 + 1x5 + 1x6 + 1x7 + 1x8 + 1x9 + 1x10 + 1x11 + 1x12  >=1
1x1 + 1x2 + 1x3 + 1x4 + 1x5 + 1x6 + 1x7 + 1x8 + 1x9 + 1x10 + 1x11 + 1x12  <=1