-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathminsumscore_PEM.m
34 lines (33 loc) · 1 KB
/
minsumscore_PEM.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
%Author: Zsolt T. Koszty�n Ph.D, University of Pannonia
%----------------
%Calculate minimal sum of score values of possible project scenarios
%----------------
%Output:
%score: the maximal score value of the project scenario
%Inputs:
%PEM: N by N upper triangular adjacency matrix of logic network
%P: N by N score matrix of task/dependency inclusion
%Q: N by N score matrix of task/dependency exclusion
%----------------
%Usage:
%minsumscore_PEM(PEM,P,Q)
%----------------
%Example:
%
% % |0.8, 0.4, 0.8|
% %PEM=|0.0, 0.7, 0.7| P=PEM Q=1-P
% % |0.0, 0.0, 0.4|
%
%PEM=[[0.8,0.4,0.8];[0.0,0.7,0.7];[0.0,0.0,0.4]];P=PEM;Q=ones(3,3)-P;
%minsumscore_PEM(PEM,P,Q)
function score=minsumscore_PEM(PEM,P,Q)
score=1;
PEM=triu(PEM(:,1:size(PEM,1)));
p=diag(P);
q=diag(Q);
pem=diag(PEM);
N=numel(pem);
pqmax=min([p,q],[],2);
if N>0 %The score of the project scenario is the sum of maximum task scores
score=sum([p(pem==1);q(pem==0);pqmax(pem>0&pem<1)]);
end