Escolar Documentos
Profissional Documentos
Cultura Documentos
TARMA PER
2017-I
INTRODUCCION
%BANDERAS O CENTINELAS
band=0;
cent=1;
n_oferta=str2num(char(resp(1)));
n_demanda=str2num(char(resp(2)));
v_oferta=zeros(n_oferta,1);
v_demanda=zeros(1,n_demanda);
Matrizp=zeros(n_oferta,n_demanda);
band=1;
cent=0;
else
%MENSAJE DE ADVERTENCIA
waitfor(warndlg('La cantidad de Ofetas y Demandas deben estar en un valor entre 2 y
10','ERROR AL INTRODUCIR LOS DATOS'));
end
elseif(length(resp)==0)
cent=0;
else
%MENSAJE DE ADVERTENCIA
waitfor(warndlg(' ERROR AL INTRODUCIR LOS DATOS, POR FAVOR INTENTE DE NUEVO
','ERROR DE PROCESO'));
end
end
AGREGAR
%SE DEFINE UNA FUNCION LLAMADA AGREGAR CON UNA VARIABLE OPCION
function agregar(opcion)
global a b c oferta demanda;
mas_demanda=0;
mas_oferta=0;
%ES UNA VARIABLE DE DECISIN QUE NOS QUIERE DECIR.. SI OPCION A ELEGIR ES IGUAL A 1
ENTONCES SE DESARROLLA LA SIGUENTE OPERACIN EN LAS MATRICES QUE EN ESTE CASO EL
AUMENTO DE OFERTAS QUE SE ENCUENTRA EN LAS COLUMNAS Y AADIRA VALORES EN LAS
FILAS Y COLUMNAS PARA PODER SEGUIR CON EL PROCEDIMIENTO.
if(opcion==1)
resp_1=inputdlg({Cxa},Cx1,1,{'0'});
%EN ESTA PARTE SE LE LLAMA IF ANIDADO YA QUE ES UN IF DENTRO DE OTRO IF Y NOS
QUIERE DECIR QUE SI EL TAMAO O LONGITUD DE RESP_1 ES DIFERENTE DE 0 ENTONCES SE
REALIZA UNA OPERACIN.
if(size(resp_1)~=0)
mas_oferta=str2num(char(resp_1(1)));
end
%MUESTRA LA MATRIS I,J DEACUERDO A LAS VARIABLES DECLARADAS, CON LA FUNCION GET
QUE SIGNIFICA RECUPERAR VALORES
x_a(i,j)=str2num( get( a(i,j) ,'String'));
end
end
for k = 1:g
x_b(1,k)=str2num( get( b(1,k) ,'String'));
end
for t = 1:h
x_c(t,1)=str2num( get( c(t,1) ,'String'));
end
CLF(gcf);
cuadro(oferta , demanda , mas_oferta, 0);
end
resp_1=inputdlg({Cxb},Cx2,1,{'0'});
if(size(resp_1)~=0)
mas_demanda=str2num(char(resp_1(1)));
end
[h,g] = size(a);
for i = 1:h
for j = 1:g
x_a(i,j)=str2num( get( a(i,j) ,'String'));
end
end
for k = 1:g
x_b(1,k)=str2num( get( b(1,k) ,'String'));
end
for t = 1:h
x_c(t,1)=str2num( get( c(t,1) ,'String'));
end
CLF(gcf);
cuadro(oferta , demanda , 0, mas_demanda);
end
[i_top,j_top]=size(a);
for i = 1:i_top-mas_oferta
for j = 1:j_top-mas_demanda
set(a(i,j),'String',x_a(i,j));%num2str(cz(i,j)
end
end
for k = 1:j_top-mas_demanda
set(b(1,k),'String',x_b(1,k));
end
for t = 1:i_top-mas_oferta
set(c(t,1),'String',x_c(t,1));
end
BALANCEAR
%ESTA ES UNA FUNCION CON NOMBRE BALANCEAR Y DE VARIABLE OPCION O TAMBIEN
LLAMADA METODO BALANCEAR.
function balancear(opcion)
%DEFINICION DE VARIABLES
mas_demanda=0;
mas_oferta=0;
sum_b=0;
sum_c=0;
band_a=0;
%ESTA OPCION NOS PERMITE REALIZAR EL BALANCE ENTRE OFERTAS Y DEMANDAS, DECLARA
CONDICIONES DE ACUERDO A LA CANTIDAD DE OFERTA Y DEMANDA EN ESTE CASO SUM_B
QUE ES LA SUMA DE OFERTAS Y SUM_C QUE ES LA SUMA DE DEMANDAS LO CUAL SI LA
OFERTA ES MAYOR SE AGREGA UNA COLUMNA Y EL VALOR QUE FALTA PARA SER
BALANCEADO, Y SIEN CASO LA DEMANDA FUERA MAYOR ENTONCES SE AGREGA UNA FILA
CON EL VALOR QUE FALTA PARAQUE ESTEN BALANCEADOS, CON LA RESTRUICCION DE QUE EL
NUMERO NO SE RESTE.
if(opcion==1)
[h,g] = size(a);
for i = 1:h
for j = 1:g
x_a(i,j)=str2num( get( a(i,j) ,'String'));
end
end
for k = 1:g
x_b(1,k)=str2num( get( b(1,k) ,'String'));
sum_b=sum_b+x_b(1,k);
end
for t = 1:h
x_c(t,1)=str2num( get( c(t,1) ,'String'));
sum_c=sum_c+x_c(t,1);
end
if sum_b~=sum_c
mas_oferta=1;
valbal=sum_b-sum_c;
CLF(gcf);
cuadro(oferta , demanda , mas_oferta, 0);
band_a=1;
end
if sum_c > sum_b
mas_demanda=1;
valbal=sum_c-sum_b;
CLF(gcf);
cuadro(oferta , demanda , 0, mas_demanda);
band_a=2;
end
end
end
CALCULO
CICLO
%DECLARANDO LA FUNCION CICLO QUE SERA UN VECTOR DE Y FILAS CON NUEVA_BASICAS
COLUMNAS.
function [y,nueva_basicas]=ciclo(x,fila,col,b)
% [y,nueva_basicas]=ciclo(x,fila,col)
% x: solucin actual (m*n)
% b: variables bsicas que entran (m*n)
% fila,col: ndice para la base del elemento que entra
% y: solucin despus del ciclo del cambio (m*n)
% nueva_basicas: nuevas variables bsicas despus del ciclo del cambio (m*n)
nueva_basicas=b;
y=x;
[m,n]=size(x);
lazo=[fila col]; % describe el ciclo del cambio
x(fila,col)=Inf; % no incluir (fila, columna) en la bsqueda
b(fila,col)=Inf;
busca_fila=1; % comenzar a buscar en la misma fila
while (lazo(1,1)~=fila | lazo(1,2)~=col | length(lazo)==2),
if busca_fila, % bsqueda en fila
j=1;
while busca_fila
if (b(lazo(1,1),j)~=0) & (j~=lazo(1,2))
lazo=[lazo(1,1) j ;lazo]; % agregar los ndices del elemento encontrado al lazo
busca_fila=0; % comenzar a buscar en columnas
elseif j==n, % ningn elemento que se interese en esta fila
b(lazo(1,1),lazo(1,2))=0;
lazo=lazo(2:length(lazo),:); % retrocede
busca_fila=0;
else
j=j+1;
end
end
else % bsqueda de la columna
i=1;
while ~busca_fila
if (b(i,lazo(1,2))~=0) & (i~=lazo(1,1))
lazo=[i lazo(1,2) ; lazo];
busca_fila=1;
elseif i==m
b(lazo(1,1),lazo(1,2))=0;
lazo=lazo(2:length(lazo),:);
busca_fila=1;
else
i=i+1;
end
end
end
end
% CLCULO MXIMO - LAZO DE ENVO
l=length(lazo);
val_tmp=Inf;
menor_val=Inf;
for i=2:2:l
if x(lazo(i,1),lazo(i,2))<val_tmp,
val_tmp=x(lazo(i,1),lazo(i,2));
menor_val=i;
end;
end
CUADRO
%ESTA FUNCION ES DEL DISEO DEL CUADRO PARA EL INGRESO DE DATOS PARA EL
DESARROLLO DEL METODO DE TRANSPORTE
function cuadro(n_ofe ,n_dem , m_ofe, m_dem)
% entradas:
% n_ofe: cantidad de ofertas
% n_dem: cantidad de demandas
% m_ofe: cantidad de nueva oferta
% m_dem: cantidad de nueva demanda
oferta=n_ofe + m_ofe;
demanda=n_dem + m_dem;
arr_size = [oferta,demanda];
rz=zeros(oferta,demanda);
bz=zeros(1,demanda);
cz=zeros(oferta,1);
a=zeros(oferta,demanda);
b=zeros(1,demanda);
c=zeros(oferta,1);
% DISEO DE LA INTERFACE
whitebg([1 1 1]); % Coloca las letras en negro
set(gcf,'Name' ,'Transporte - Guillermo Montoya - Versin: 1.0 Beta');
set(gcf,'MenuBar','none');
set(gcf,'Resize','off');
set(gcf,'NumberTitle','off');
set(gcf,'Units', 'pixels');
set(gcf,'position',[100 100 fig_dim(2) fig_dim(1)]);
set(gcf,'Color',[0 0.50 0.50]);
for i = 1:arr_size(1)
for j = 1:arr_size(2)
a(i,j)=uicontrol('Style','edit','BackgroundColor',[1 1
0],'String',num2str(rz(i,j)),'unit','pixels','position', [posx posy 50 20]); %[posx posy 50 20]
tol_a=sprintf(' X %d,%d ',i,j);
set(a(i,j),'TooltipString',tol_a);
posx = posx+50+bd_size; end
posx = posxb;
posy = posy-20-bd_size;
end
[xt_b,yt_b] = size(bz);
ren_dem_size = [1,yt_b];
for i = 1:ren_dem_size(1)
for j = 1:ren_dem_size(2)
b(i,j)=uicontrol('Style','edit','BackgroundColor',[1 1
1],'String',num2str(bz(i,j)),'unit','pixels','position', [posx_b posy_b 50 20]);
tol_b=sprintf('Demanda n: %d',j);
set(b(i,j),'TooltipString',tol_b);
posx_b = posx_b+50+bd_size; end
posx_b = posxb_b;
posy_b = posy_b-20-bd_size;
end
% COLUMNA DE OFERTAS
bd_size = 5; %border size
posx_c = posx+50*demanda+bd_size*demanda;%posx+(posx*yt_c)+(bd_size*yt_c); %posicion
horizontal
posxb_c = posx_c;
posy_c = fig_dim(1)-50-bd_size;
[xt_c,yt_c] = size(cz);
col_ofer_size = [xt_c,1];
for i = 1:col_ofer_size(1)
for j = 1:col_ofer_size(2)
c(i,j)=uicontrol('Style','edit','BackgroundColor',[1 1
1],'String',num2str(cz(i,j)),'unit','pixels','position', [posx_c posy_c 50 20]); %[posx posy 50 20]
tol_c=sprintf('Oferta n: %d',i);
set(c(i,j),'TooltipString',tol_c);
posx_c = posx_c+50+bd_size;
end
posx_c = posxb_c;
posy_c = posy_c-20-bd_size;
end
% BOTON DE AGREGAR FILA OFERTA
Addfil = uicontrol(gcf,...
'Style','pushbutton',...
'FontSize',8,'FontName','Arial',...
'Units', 'pixels',...
'Position',[posx_c-165 posy_c-55 105 20],...
'String','Agregar Oferta',...
'CallBack','agregar(1);');
% % BOTON DE BALANCEAR
Balan = uicontrol(gcf,...
'Style','pushbutton',...
'FontSize',8,'FontName','Arial',...
'Units', 'pixels',...
'Position',[posx_c-165 posy_c-75 105 20],...
'String','Balancear',...
'CallBack','balancear(1);');
% BOTON DE CALCULO
Calcular = uicontrol(gcf,...
'Style','pushbutton',...
'FontSize',8,'FontName','Arial',...
'Units', 'pixels',...
'Position',[posx_c posy_c-17 52 20],...
'String','Calcular');%,...
set(Calcular,'callback','calculo;');
MASPOS
dim = size(vargin);
if length(dim)~=2
error('Matriz Invlida!');
end
maxv=0;
fil=0;
col=0;
MULTIPLICADORES
%DECLARANDO LA FUNCION MULTIPLICADORES
%ESTA FUNCION NOS PERMITE MULTIPLICAR TODOS LOS VALORES DENTRO DE LA MATRIS E IR
IGUALANDO UNA POR UNA EN EL METODO DE TRANSPORTE PARA QUE LA OFERTA Y
DEMANDA VAYE DESAPARECIENDO
Funcion [u,v]=multiplicadores(x,c,b)
M TRANSPORTE
%DEFINIENDO LA FUNCION M TRANSPORTE
function [x,costo]=m_transporte(s,d,c);
% function [x,cost]=transporte(s,d,c)
%
% s = ofertas (m*1)
% d = demanda (n*1)
% c = costos (m*n)
% x = solucin ptima (m*n)
% cost = costo de transporte mnimo
% Introducir b como una matriz con unos para las variables bsicas
% y ceros para las variables no bsicas.
%clc
disp(' La regla del noroeste da una solucin bsica inicial.');
disp(' Cuadro del transporte [x s;d'' 0]')
[x,b]=noroeste(s,d);
[x s;d' 0]
disp(' ')
costo_ini=num2str(sum(sum(c.*x)));
disp([' Costo de transporte = ',num2str(sum(sum(c.*x)))]);
disp(' ')
[tamx,tamy]=size(x);
resultado(tamx,tamy);
set(nb,'visible','off');
set(vs,'visible','off');
set(us,'visible','off');
set(TITULUS,'visible','off');
set(TITULVS,'visible','off');
vbc=0;%acumulador para imprimir
for i = 1:tamx
for j = 1:tamy
if (x(i,j)~=0)
set(cuadro(i,j),'String',num2str(x(i,j)));
vals1=sprintf('%d',x(i,j));
vals2=sprintf('%d',c(i,j));
vbas{i+j}=sprintf('X %d,%d = %s',i,j,vals1);
mult=sprintf('%d',x(i,j)*c(i,j));
cosbas{i+j}=sprintf('%s x %s = %s',vals1,vals2,mult);
end
set(costo(i,j),'String',num2str(c(i,j)));
end
end
tp=d';
for j = 1:tamy
set(b2(1,j),'String',num2str(tp(1,j)));
end
for i = 1:tamx
set(c2(i,1),'String',num2str(s(i,1)));
end
solbasica(vbas,cosbas,costo_ini);
%PAUSE
waitfor(warndlg('Solucin Bsica Inicial...Precione (OK) para continuar','Cuadro de
Transporte'));
iter=0;
while 1
[u,v]=multiplicadores(x,c,b);
disp(' Cuadro de costos [c u;v'' 0]');
[c u;v' 0]
%%%%%
set(TITULUS,'visible','on');
set(TITULVS,'visible','on');
set(vs,'visible','on');
set(us,'visible','on');
tk=v';
for j = 1:tamy
set(vs(1,j),'String',num2str(tk(1,j)));
end
for i = 1:tamx
set(us(i,1),'String',num2str(u(i,1)));
end
%PAUSE
waitfor(warndlg('Mtodo de Multiplicadores Aplicado...Precione (OK) para
continuar','Cuadro de Transporte'));
disp(' ')
disp(' Costos reducidos ')
r=(c-u*ones(size(v'))-ones(size(u))*v')*(-1);
set(nb,'visible','off');
for i = 1:tamx
for j = 1:tamy
if (r(i,j)~=0)
set(nb(i,j),'visible','on');
set(nb(i,j),'String',num2str(r(i,j)));
end
end
end
if any(any(r<0))
disp(' ')
[maxv,i,j] = maspos(r);
if(maxv==0)
break
end
else
break
end;
disp(' ')
disp(' Cuadro del transporte [x s;d'' 0]');
var_ent=sprintf('Entra X %d,%d con valor= %d',i,j,maxv);
waitfor(warndlg(var_ent,'Variable ms positiva que Entra'));
[x,b]=ciclo(x,i,j,b);
[x s;d' 0]
for i = 1:tamx
for j = 1:tamy
if (b(i,j)==1)
set(cuadro(i,j),'String',num2str(x(i,j)));
else
set(cuadro(i,j),'String','');
end
end
end
disp(' ')
%PAUSE
waitfor(warndlg('Construccin de Ciclo Aplicado...Precione (OK) para continuar','Cuadro de
Transporte'));
cost=[cost ; sum(sum(c.*x))];
fprintf('Costo de transporte = %g\n\n',cost(length(cost)));
etiq=sprintf('Costo de Transporte = %g para la Iteracin N %d',cost(length(cost)),iter+1);
waitfor(warndlg(etiq,'Costo de Transporte'));
cost_iter{iter+1}=sprintf('\n%d )- %d',iter+1,cost(length(cost)));
iter=iter+1;
end
for i = 1:tamx
for j = 1:tamy
if (~isempty(get(cuadro(i,j),'String')))
valsb1=sprintf('%d',x(i,j));
valsb2=sprintf('%d',c(i,j));
vbasc{j,i}=sprintf('X %d,%d = %s',i,j,valsb1);
multb=sprintf('%d',x(i,j)*c(i,j));
costbas{j,i}=sprintf('%s x %s = %s',valsb1,valsb2,multb);
end
end
end
disp(' ')
%PAUSE
waitfor(warndlg('Clculo Terminado...Precione (OK) para continuar','Cuadro de Transporte'));
fprintf('Costos de transporte para todas las iteraciones:\n');
cost
if(isempty(cost))
else
solcosto(cost_iter,cost(length(cost)),vbasc,costbas);
end
set(Calcular,'enable','on');
RESULTADO
oferta=n_ofe;
demanda=n_dem;
arr_size = [oferta,demanda];
rz=zeros(oferta,demanda);
bz=zeros(1,demanda);
cz=zeros(oferta,1);
a=zeros(oferta,demanda);
b=zeros(1,demanda);
c=zeros(oferta,1);
if arr_size(2) < 2
fig_dim = [arr_size(1)*25+400, 650];
else
fig_dim = [arr_size(1)*25+400, arr_size(2)*60+360];
end
% DISEO DE LA INTERFACE
t2=figure;
whitebg([1 1 1]); % Coloca las letras en negro
set(gcf,'Name' ,'Resultado:.');
set(gcf,'MenuBar','none');
set(gcf,'Resize','off');
set(gcf,'NumberTitle','off');
set(gcf,'Units', 'pixels');
set(gcf,'position',[2 2 fig_dim(2) fig_dim(1)]);
set(gcf,'Color',[0 0.50 0.50]);
% RENGLON DE VS
bd_size = 5; %borde size
posx_b = bd_size+100; %posicion horizontal
posxb_b = posx_b;
posy_b = fig_dim(1)-80-bd_size;
[xt_b,yt_b] = size(bz);
ren_dem_size = [1,yt_b];
for j = 1:ren_dem_size(2)
vs(1,j)=uicontrol('Style','edit','BackgroundColor',[1 1 1],'String','','unit','pixels','position',
[posx_b posy_b 80 30]);
tol_b=sprintf('V%d:',j);
set(vs(1,j),'TooltipString',tol_b);
TITULVS(1,j) = uicontrol(gcf,'Style','text','BackgroundColor',[0.3 0.7
0.3],'FontSize',10,'FontName','ARIAL','FontWeight','bold','ForegroundColor', [1 1 1],...
'String',tol_b,'Units', 'pixels','Position',[posx_b posy_b+30 80 15]);
posx_b = posx_b+70+bd_size;
end
% COLUMNA DE US
bd_size = 5; %borde size
posx_c = bd_size+500;
posxb_c = posx_c;
posy_c = fig_dim(1)-150-bd_size;
[xt_c,yt_c] = size(cz);
col_ofer_size = [xt_c,1];
for i = 1:col_ofer_size(1)
us(i,1)=uicontrol('Style','edit','BackgroundColor',[1 1 1],'String','','unit','pixels','position',
[posx_c-475 posy_c 70 30]);
tol_c=sprintf('U%d:',i);
set(us(i,1),'TooltipString',tol_c);
TITULUS(i,1) = uicontrol(gcf,'Style','text','BackgroundColor',[0.3 0.7
0.3],'FontSize',10,'FontName','ARIAL','FontWeight','bold','ForegroundColor', [1 1 1],...
'String',tol_c,'Units', 'pixels','Position',[posx_c-475 posy_c+30 70 15]);
posx_c = posxb_c;
posy_c = posy_c-45-bd_size;
end
% MATRIZ DE ASIGNACION
bd_size = 5; %borde size
posx = bd_size+100; %posicion horizontal
posxb = posx;
posy = fig_dim(1)-150-bd_size;
for i = 1:arr_size(1)
for j = 1:arr_size(2)
cuadro(i,j)=uicontrol('Style','edit','BackgroundColor',[0.75 0.75
0.75],'String','','unit','pixels','ForegroundColor',[0.25 0.25 1]
,'HorizontalAlignment','center','position', [posx posy 80 50]);
tol_a=sprintf(' X %d,%d ',i,j);
set(cuadro(i,j),'TooltipString',tol_a);
posx = posx+70+bd_size;
end
posx = posxb;
posy = posy-45-bd_size;
end
for i = 1:arr_size(1)
for j = 1:arr_size(2)
nb(i,j)=uicontrol('Style','edit','BackgroundColor',[1 1
1],'String','','unit','pixels','ForegroundColor',[1 0.25 0.25]
,'HorizontalAlignment','center','position', [posx posy 55 15]);
tol_a=sprintf(' X %d,%d ',i,j);
set(nb(i,j),'TooltipString',tol_a);
posx = posx+70+bd_size;
end
posx = posxb;
posy = posy-45-bd_size;
end
% MATRIZ DE COSTOS
bd_size = 5; %borde size
posxc = bd_size+100; %posicion horizontal
posxbc = posxc;
posyc = fig_dim(1)-150-bd_size;
for i = 1:arr_size(1)
for j = 1:arr_size(2)
costo(i,j)=uicontrol('Style','edit','BackgroundColor',[1 1
0],'String','','unit','pixels','ForegroundColor',[0 0 0] ,'HorizontalAlignment','center','position',
[posxc+23 posyc+34 55 15]);
tol_a=sprintf(' X %d,%d ',i,j);
set(costo(i,j),'TooltipString',tol_a);
posxc = posxc+70+bd_size;
end
posxc = posxbc;
posyc = posyc-45-bd_size;
end
% RENGLON DE DEMANDAS
bd_size = 5; %borde size
posx_b = bd_size+100; %posicion horizontal
posxb_b = posx_b;
posy_b = posy-10-bd_size;
[xt_b,yt_b] = size(bz);
ren_dem_size = [1,yt_b];
for i = 1:ren_dem_size(1)
for j = 1:ren_dem_size(2)
b2(i,j)=uicontrol('Style','edit','BackgroundColor',[1 1
1],'String',num2str(bz(i,j)),'unit','pixels','position', [posx_b posy_b 80 30]);
tol_b=sprintf('Demanda n: %d',j);
set(b2(i,j),'TooltipString',tol_b);
posx_b = posx_b+70+bd_size;
end
posx_b = posxb_b;
posy_b = posy_b-25-bd_size;
end
% COLUMNA DE OFERTAS
bd_size = 5; %borde size
posx_c = posx+75*demanda+bd_size*demanda;
posxb_c = posx_c;
posy_c = fig_dim(1)-150-bd_size;
[xt_c,yt_c] = size(cz);
col_ofer_size = [xt_c,1];
for i = 1:col_ofer_size(1)
for j = 1:col_ofer_size(2)
c2(i,j)=uicontrol('Style','edit','BackgroundColor',[1 1
1],'String',num2str(cz(i,j)),'unit','pixels','position', [posx_c posy_c 80 50]);
tol_c=sprintf('Oferta n: %d',i);
set(c2(i,j),'TooltipString',tol_c);
posx_c = posx_c+70+bd_size;
end
posx_c = posxb_c;
posy_c = posy_c-45-bd_size;
end
% BOTON DE SALIR
Salir = uicontrol(gcf,...
'Style','pushbutton',...
'FontSize',8,'FontName','Arial',...
'Units', 'pixels',...
'Position',[posx_c posy_c-17 80 30],...
'String','< Salir >..',...
'CallBack', 'close;');
SOLBASICA
% DISEO DE LA INTERFACE
t3=figure;
whitebg([1 1 1]); % Coloca las letras en negro
set(gcf,'Name' ,'Solucin Basica Inicial');
set(gcf,'MenuBar','none');
set(gcf,'Resize','off');
set(gcf,'NumberTitle','off');
set(gcf,'Units', 'pixels');
set(gcf,'position',[200 200 450 300]);
set(gcf,'Color',[0 0.50 0.50]);
%TITULO
TITULOA = uicontrol(gcf,...
'Style','text',...
'BackgroundColor',[0.3 0.7 0.3],...
'FontSize',10,'FontName','ARIAL',...
'FontWeight','bold',...
'ForegroundColor', [1 1 1],...
'String','Variables Bsicas:',...
'Units', 'pixels',...
'Position',[10 270 215 20]);
%TITULO
TITULOB = uicontrol(gcf,...
'Style','text',...
'BackgroundColor',[0.3 0.7 0.3],...
'FontSize',10,'FontName','ARIAL',...
'FontWeight','bold',...
'ForegroundColor', [1 1 1],...
'String','Costo:',...
'Units', 'pixels',...
'Position',[230 270 215 20]);
%V. BSICAS
RESULT_A= uicontrol(gcf,...
'Style','edit',...
'BackgroundColor',[0 0.50 0.50],...
'FontSize',10,'FontName','ARIAL',...
'FontWeight','bold',...
'ForegroundColor', [1 1 1],...
'HorizontalAlignment','left',...
'String',vbas,...
'Units', 'pixels',...
'Max',100,...
'Position',[10 115 215 150]);
%COSTO
RESULT_B= uicontrol(gcf,...
'Style','edit',...
'BackgroundColor',[0 0.50 0.50],...
'FontSize',10,'FontName','ARIAL',...
'FontWeight','bold',...
'ForegroundColor', [1 0 0],...
'HorizontalAlignment','left',...
'String',cosbas,...
'Units', 'pixels',...
'Max',100,...
'Position',[230 115 215 150]);
%COSTO TOTAL
TITULOC = uicontrol(gcf,...
'Style','text',...
'BackgroundColor',[0.3 0.7 0.3],...
'FontSize',10,'FontName','ARIAL',...
'FontWeight','bold',...
'ForegroundColor', [1 1 1],...
'String','COSTO TOTAL =',...
'Units', 'pixels',...
'Position',[10 80 215 20]);
%COSTO TOTAL
TITULOD = uicontrol(gcf,...
'Style','text',...
'BackgroundColor',[0.3 0.7 0.3],...
'FontSize',10,'FontName','ARIAL',...
'FontWeight','bold',...
'ForegroundColor', [1 0 0],...
'String',costo_total,...
'Units', 'pixels',...
'Position',[230 80 215 20]);
%CERRAR
cerrasol=uicontrol(gcf,...
'Style','pushbutton',...
'FontSize',10,'FontName','ARIAL',...
'FontWeight','bold',...
'ForegroundColor', [0 0.50 0.50],...
'String','< Cerrar >',...
'Units', 'pixels',...
'Position',[180 10 100 20],...
'callback','close;');
SOLCOSTO
% DISEO DE LA INTERFACE
t4=figure;
whitebg([1 1 1]); % Coloca las letras en negro
set(gcf,'Name' ,'Costo Total de Transporte');
set(gcf,'MenuBar','none');
set(gcf,'Resize','off');
set(gcf,'NumberTitle','off');
set(gcf,'Units', 'pixels');
set(gcf,'position',[50 200 680 300]);
set(gcf,'Color',[0 0.50 0.50]);
%TITULO
TITULOA = uicontrol(gcf,...
'Style','text',...
'BackgroundColor',[0.3 0.7 0.3],...
'FontSize',10,'FontName','ARIAL',...
'FontWeight','bold',...
'ForegroundColor', [1 1 1],...
'String','Variables Bsicas:',...
'Units', 'pixels',...
'Position',[10 270 215 20]);
%TITULO
TITULOB = uicontrol(gcf,...
'Style','text',...
'BackgroundColor',[0.3 0.7 0.3],...
'FontSize',10,'FontName','ARIAL',...
'FontWeight','bold',...
'ForegroundColor', [1 1 1],...
'String','Costo:',...
'Units', 'pixels',...
'Position',[230 270 215 20]);
%TITULO
TITULOC = uicontrol(gcf,...
'Style','text',...
'BackgroundColor',[0.3 0.7 0.3],...
'FontSize',10,'FontName','ARIAL',...
'FontWeight','bold',...
'ForegroundColor', [1 1 1],...
'String','Costos para toda las Iteraciones:',...
'Units', 'pixels',...
'Position',[450 270 215 20]);
%V. BSICAS
RESULT_A= uicontrol(gcf,...
'Style','edit',...
'BackgroundColor',[1 1 1],...
'FontSize',10,'FontName','ARIAL',...
'FontWeight','bold',...
'ForegroundColor', [0 0 1],...
'HorizontalAlignment','left',...
'String',vbasc,...
'Units', 'pixels',...
'Max',100,...
'Position',[10 85 215 180]);
%COSTO
RESULT_B= uicontrol(gcf,...
'Style','edit',...
'BackgroundColor',[1 1 1],...
'FontSize',10,'FontName','ARIAL',...
'FontWeight','bold',...
'ForegroundColor', [0 0 1],...
'HorizontalAlignment','left',...
'String',costos_f,...
'Units', 'pixels',...
'Max',100,...
'Position',[230 85 215 180]);
%SOLUCIONES ITERACIONES
RESULT_C= uicontrol(gcf,...
'Style','edit',...
'BackgroundColor',[1 1 1],...
'FontSize',10,'FontName','ARIAL',...
'FontWeight','bold',...
'ForegroundColor', [1 0 0],...
'HorizontalAlignment','center',...
'String',costo_i,...
'Units', 'pixels',...
'Max',100,...
'Position',[450 85 215 180]);
%COSTO TOTAL
TITULOC = uicontrol(gcf,...
'Style','text',...
'BackgroundColor',[0.3 0.7 0.3],...
'FontSize',10,'FontName','ARIAL',...
'FontWeight','bold',...
'ForegroundColor', [1 1 1],...
'String','COSTO TOTAL =',...
'Units', 'pixels',...
'Position',[10 58 215 20]);
%COSTO TOTAL
TITULOD = uicontrol(gcf,...
'Style','text',...
'BackgroundColor',[0.3 0.7 0.3],...
'FontSize',10,'FontName','ARIAL',...
'FontWeight','bold',...
'ForegroundColor', [1 0 0],...
'String',costo_total,...
'Units', 'pixels',...
'Position',[230 58 215 20]);
CONCLUSIONES