Re: Plotting feasible region of a linear programme
- To: mathgroup at smc.vnet.net
- Subject: [mg112822] Re: Plotting feasible region of a linear programme
- From: Yaroslav Bulatov <yaroslavvb at gmail.com>
- Date: Sat, 2 Oct 2010 05:43:55 -0400 (EDT)
- References: <i81j79$a07$1@smc.vnet.net>
On Sep 30, 1:54 am, Yaroslav Bulatov <yarosla... at gmail.com> wrote: > What is a good way to visualize feasible region of a 3-variable linear > programme in Mathematica? I tried RegionPlot3D but you can see the > result is lacking in aesthetics > > randomCons := Module[{}, > hadamard = KroneckerProduct @@ Table[{{1, 1}, {1, -1}}, {3}]; > invHad = Inverse[hadamard]; > vs = Range[8]; > m = mm /@ vs; > sectionAnchors = Subsets[vs, {1, 7}]; > randomSection := > Mean[hadamard[[#]] & /@ #] & /@ > Prepend[RandomChoice[sectionAnchors, 3], vs]; {p0, p1, p2, p3} = > randomSection; > section = > Thread[m -> > p0 + {x, y, z}.Orthogonalize[{p1 - p0, p2 - p0, p3 - p0}]]; > And @@ Thread[invHad.m >= 0 /. section] > ]; > Table[RegionPlot3D @@ {randomCons, {x, -3, 3}, {y, -3, 3}, {z, -3, > 3}}, {10}] I got a suggestion from Maxim Rytin to use a legacy package InequalityPlot, and it works much better than RegionPlot3D for this problem. I've put comparison in parallel stackoverflow thread -- http://stackoverflow.com/questions/3815496/plotting-linear-inequalities-in-mathematica. Two issues remain -- 1) it creates more polygons than necessary, so can't use EdgeForm to outline edges of the region 2) sometimes faces are missed