Code covered by the BSD License  

Highlights from
Supply Chain Risk Simulator (SCRS)

from Supply Chain Risk Simulator (SCRS) by Marco Anisetti
Supply Chain simulator for risk assessment and incentive schemes.

SupplyChain(varargin)
function varargout = SupplyChain(varargin)
% SUPPLYCHAIN M-file for SupplyChain.fig
%      SUPPLYCHAIN, by itself, creates a new SUPPLYCHAIN or raises the existing
%      singleton*.
%
%      H = SUPPLYCHAIN returns the handle to a new SUPPLYCHAIN or the handle to
%      the existing singleton*.
%
%      SUPPLYCHAIN('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in SUPPLYCHAIN.M with the given input arguments.
%
%      SUPPLYCHAIN('Property','Value',...) creates a new SUPPLYCHAIN or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before SupplyChain_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to SupplyChain_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's11 Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help SupplyChain

% Last Modified by GUIDE v2.5 28-May-2009 18:03:08

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @SupplyChain_OpeningFcn, ...
                   'gui_OutputFcn',  @SupplyChain_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before SupplyChain is made visible.
function SupplyChain_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to SupplyChain (see VARARGIN)

% Choose default command line output for SupplyChain
handles.output = hObject;

handles.scelti=varargin{1};
handles.Suppliers=varargin{2};
handles.PayOff=varargin{3};
handles.ShapleyValues=varargin{4};
handles.probability=varargin{5};
handles.risk=varargin{6};
handles.impact=varargin{7};

for(i=1:1:length(handles.scelti))
    %red square for the selected suppliers
    switch(handles.scelti(i))
    case 1
          set(handles.Avio,'ShadowColor','r');
          set(handles.pushbutton20,'Enable','on');
    case 2
          set(handles.S1,'ShadowColor','r');
          set(handles.S1P11,'Enable','on');
    case 3
          set(handles.S1,'ShadowColor','r');
          set(handles.S1P12,'Enable','on');
    case 4
          set(handles.S2,'ShadowColor','r');
          set(handles.S2P12,'Enable','on');
    case 5
          set(handles.S3,'ShadowColor','r');
          set(handles.S3P12,'Enable','on');
    case 6
          set(handles.S11,'ShadowColor','r');
          set(handles.S11P111,'Enable','on');
    case 7
          set(handles.S12,'ShadowColor','r');
          set(handles.S12P112,'Enable','on');
    case 8
          set(handles.S21,'ShadowColor','r');
          set(handles.S21P111,'Enable','on');
    case 9
          set(handles.S22,'ShadowColor','r');
          set(handles.S22P112,'Enable','on');
    end     
end

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes SupplyChain wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = SupplyChain_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes on button press in S1P11.
function S1P11_Callback(hObject, eventdata, handles)
% hObject    handle to S1P11 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[handles.Supp(2).object]=Nodo(handles.Suppliers(2),handles.PayOff(2),handles.ShapleyValues(2),handles.probability(2),handles.risk(2), handles.impact(2));

% --- Executes on button press in S1P12.
function S1P12_Callback(hObject, eventdata, handles)
% hObject    handle to S1P12 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[handles.Supp(3).object]=Nodo(handles.Suppliers(3),handles.PayOff(3),handles.ShapleyValues(3),handles.probability(3),handles.risk(3), handles.impact(3));
% --- Executes on button press in pushbutton3.

% --- Executes on button press in S2P12.
function S2P12_Callback(hObject, eventdata, handles)
% hObject    handle to S2P12 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[handles.Supp(4).object]=Nodo(handles.Suppliers(4),handles.PayOff(4),handles.ShapleyValues(4),handles.probability(4),handles.risk(4), handles.impact(4));

% --- Executes on button press in S3P12.
function S3P12_Callback(hObject, eventdata, handles)
% hObject    handle to S3P12 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[handles.Supp(5).object]=Nodo(handles.Suppliers(5),handles.PayOff(5),handles.ShapleyValues(5),handles.probability(5),handles.risk(5), handles.impact(5));

% --- Executes on button press in S11P111.
function S11P111_Callback(hObject, eventdata, handles)
% hObject    handle to S11P111 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[handles.Supp(6).object]=Nodo(handles.Suppliers(6),handles.PayOff(6),handles.ShapleyValues(6),handles.probability(6),handles.risk(6), handles.impact(6));

% --- Executes on button press in S12P112.
function S12P112_Callback(hObject, eventdata, handles)
% hObject    handle to S12P112 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[handles.Supp(7).object]=Nodo(handles.Suppliers(7),handles.PayOff(7),handles.ShapleyValues(7),handles.probability(7),handles.risk(7), handles.impact(7));

% --- Executes on button press in S21P111.
function S21P111_Callback(hObject, eventdata, handles)
% hObject    handle to S21P111 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[handles.Supp(8).object]=Nodo(handles.Suppliers(8),handles.PayOff(8),handles.ShapleyValues(8),handles.probability(8),handles.risk(8), handles.impact(8));

% --- Executes on button press in S22P112.
function S22P112_Callback(hObject, eventdata, handles)
% hObject    handle to S22P112 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[handles.Supp(9).object]=Nodo(handles.Suppliers(9),handles.PayOff(9),handles.ShapleyValues(9),handles.probability(9),handles.risk(9), handles.impact(9));

% --- Executes on button press in pushbutton20.
function pushbutton20_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton20 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[handles.Supp(1).object]=Nodo(handles.Suppliers(1),handles.PayOff(1),handles.ShapleyValues(1),handles.probability(1),handles.risk(1), handles.impact(1));


Contact us at files@mathworks.com