Boundaries points for Linear Programming (graphical)

i want to find these points without using intersection

9 Commenti

What data do you have to start with? You forgot to show your code for how you created this figure.
this is the code i used
clear;clc
%Generate data
[H,C] = meshgrid(0:0.1:10);
NB=H+2*C;
% Get True where condition aplies, false where not.
cond1=-H+C<=3;
cond2=2*H+C<=28;
cond3=C<=8;
% Get boundaries of the condition
Cp1=3+H(1,:);
Cp2=28-2*H(1,:);
Cp3=8;
%Delete Areas whereCondition does not apply;
NB(~cond1)=NaN;
NB(~cond2)=NaN;
NB(~cond3)=NaN;
%% Plot
[C,h]=contourf(H,C,NB,20);
hold on
plot(H(1,:),Cp1,'r')
plot(H(1,:),Cp2,'k')
plot(H(1,:),ones(size(H(1,:))) * Cp3,'r')
axis([0 10 0 10])
xlabel('H, Hydropower')
ylabel('C, Crops')
What exactly you want?
HMe
HMe il 6 Giu 2020
Modificato: HMe il 6 Giu 2020
i want to get the points in the graph with matlab code not using the Data cursour so i can resolve a maximization problem for linear programming
You can use interpolation logics to get the points you want. Is that okay for you?
what's interploation logics and how to use them ???
For the give lines in the figure, if you get the intersection points is that enough?
I thought about that but i'm looking for solution that works on every system
Alexandre Riebel
Alexandre Riebel il 24 Lug 2020
Modificato: Alexandre Riebel il 24 Lug 2020
It's not clear exaclty what you are looking for. For every situation that you are looking at, will there be a point at the origin, and will there be a point on the x-axis and y-axis? Or are you just looking for the intersection point between the black and red lines?

Accedi per commentare.

Risposte (1)

John D'Errico
John D'Errico il 24 Lug 2020
Modificato: John D'Errico il 24 Lug 2020
You probably want to use the code plotregion, by Per Bergström. It can be found on the file exchange.
Of course, if you have a 4-d problem or greater, then nothing will work, at least to plot.
plotregion handles general sets of linear inequality constraints, as well as bound constraints. If you have equality constraints too, things will become more complex.
If your goal is to find the intersection points themselves, then a tool like this may be appropriate, thus the function LCON2VERT from this set of tools by Matt J.
As well, there are tools from Michael Kleder, which apparently inspired the tools from Matt.

Categorie

Scopri di più su Computational Geometry in Centro assistenza e File Exchange

Richiesto:

HMe
il 6 Giu 2020

Modificato:

il 24 Lug 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by