File Exchange

image thumbnail

plot_feasible.m

version 1.0 (16.2 KB) by

plot_feasible.m is a simple bit of code for visualizing 2D linear programming problems.

20 Downloads

Updated

View License

plot_feasible(A, b, c, lower_b, upper_b, varargin)

Plots the feasible region of the 2D linear program
maximize f = c'*x
subject to A x <= b
on the region bounded by lower_b and upper_b.

It can plot the region, bounding lines, their intersection points and vertices of the feasible region along with the maximum. Its primary use (for me) is for students learning Linear Algebra.

Its has lots of options for making the plot look pretty, or annotating vertices, etc. And you can put iso-objective function lines across the plot to help. Multiple feasible region plots are also possible, to show overlaps.

Comments and Ratings (3)

Anver Hisham

Hi,

Is it possible to plot only feasible region of a set of linear constraints?

It would be nicer, if I can call function as follows

plot_feasible(A,b)

Thanks for this code.
How can I obtain the feasible space of a Nonlinear constrained problem.
The problem I have is like this.
min F(X)
hk(X)=0 k=1,...,ne % equality constraints
gi(X)≤0 i=1,...,n % Inequality
constraints.
Ul<X<UB % UB and UL are pper and lowe bounds of X
where X=[x1,x2,...,xj]
I think that I should generate some random numbers first and then check the constraints, if generated point satisfies the constraint, so it is a feasible point. But I don't know how to check the constraint.
Thanks for your helps

Thanks for this code.
How can I obtain the feasible space of a Nonlinear constrained problem.
The problem I have is like this.
min F(X)
hk(X)=0 k=1,...,ne % equality constraints
gi(X)≤0 i=1,...,n % Inequality
constraints.
Ul<X<UB % UB and UL are pper and lowe bounds of X
where X=[x1,x2,...,xj]
I think that I should generate some random numbers first and then check the constraints, if generated point satisfies the constraint, so it is a feasible point. But I don't know how to check the constraint.
Thanks for your helps

MATLAB Release
MATLAB 7.4 (R2007a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video