Last active
August 29, 2015 14:08
-
-
Save saiberz/e0ab21fcc83839fe215a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function z = getCostMin(PowMin,PowMax,Cost,PowDem) | |
% Input Values: | |
% Output Values: | |
% See also: linprog | |
[n, ~ ] = size(PowMin); | |
z = zeros(n); | |
Ai = [eye(n)*(-1);eye(n)]; | |
bi = [zeros(n,1);PowMax]; | |
Ae = ones(1,n); | |
r = linprog(Cost,Ai,bi,Ae,PowDem); | |
aux = 1:n; | |
z = sortrows([Cost', r,aux']); | |
% a = arrayfun( @(x) linprog(Cost,Ai,bi,Ae,x), PowDem,'un',0); | |
% z = arrayfun( @(y) sortrows(y),a) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment