I have the following inequalities:
How can I visualize them and its feasible region?
I have the following inequalities:
How can I visualize them and its feasible region?
Hello, welcome to Scilab’s Discourse !
First, are you sure of the inequalities ? Because they are describing a non feasible region.
S.
You’re absolutely right. I’ll get other ones:
A simple algorithm for a domain in \mathbb{R}^2 can be the following: enumerate each pair of saturated constraints, and if the corresponding solution (x,y) verifies other inequalities, keep it as a vertex. Then your admissible domain is the convex hull of these vertices. In Scilab, I would code the algorithm like this:
// domain is described in standard form
// by A*x <= b
A = [2 -1; 2 1; -1 0; 0 -1];
b = [6; 10; 0; 0];
x = [];
m = size(A,1);
for i = 1:m-1
for j = i+1:m
if rank(A([i j],:)) == 2
u = A([i j],:)\b([i j]);
// check that vertex verifies other inequalities
k = [1:i-1 i+1:j-1 j+1:m];
if and(A(k,:)*u - b(k) < %eps)
x = [x u];
end
end
end
end
if ~isempty(x)
// compute convex hull of vertices
[_, hull] = mesh2d(x(1,:),x(2,:));
clf
h = plot(x(1,hull),x(2,hull),'-o');
h.fill_mode = 1;
h.background=color("gray");
end
Ingenious, but I am not sure, if I understood…
Heinz
Let us hope that @mtlb will !
By the way, playing with the above code, it is quite easy to illustrate the fact that in \mathbb{R}^2 a non-linear constraint such as
can be approximated (arbitrarily close) with a sequence of linear constraints under the form Ax\leq b. To illustrate this, replacing the first two lines of code above with
t = linspace(0,2*%pi,32)(1:$-1)';
A = [cos(t) sin(t)];
b = ones(t);
and re-running the script yields the following graph: