| | |
- outrankingDigraphs.BipolarOutrankingDigraph(outrankingDigraphs.OutrankingDigraph)
-
- SparseOutrankingDigraph
-
- PreRankedOutrankingDigraph(SparseOutrankingDigraph, perfTabs.PerformanceTableau)
-
- PreRankedConfidentOutrankingDigraph
class PreRankedConfidentOutrankingDigraph(PreRankedOutrankingDigraph) |
| |
PreRankedConfidentOutrankingDigraph(argPerfTab, quantiles=None, quantilesOrderingStrategy='average', LowerClosed=False, componentRankingRule='Copeland', minimalComponentSize=1, distribution='triangular', betaParameter=2, confidence=90.0, Threading=False, startMethod=None, tempDir=None, nbrOfCPUs=None, nbrOfThreads=0, save2File=None, CopyPerfTab=True, Comments=False, Debug=False)
Main class for the implementation of sparse confident outranking digraphs.
The sparse outranking digraph instance is decomposed with a confident q-tiling sort into a partition of quantile equivalence classes which are linearly ordered by average quantile limits (default).
With each quantile equivalence class is associated a ConfidentBipolarOutrankingDigraph object which is restricted to the decision actions gathered in this quantile equivalence class.
By default, the number of quantiles is set to 5 when the numer of actions is less than 100, to 10 when the number of actions is less than 1000, or otherwise to 0.5% of the numer of decision actions. The number of quantiles can be set much lower for bigger orders. Mind the effective availability of CPU memory when tackling big digraph orders.
For other parameters settings, see the corresponding classes:
:py:class:`sortingDigraphs.QuantilesSortingDigraph` and :py:class:`outrankingDigraphs.ConfidentBipolarOutrankingDigraph` . |
| |
- Method resolution order:
- PreRankedConfidentOutrankingDigraph
- PreRankedOutrankingDigraph
- SparseOutrankingDigraph
- outrankingDigraphs.BipolarOutrankingDigraph
- outrankingDigraphs.OutrankingDigraph
- digraphs.Digraph
- perfTabs.PerformanceTableau
- builtins.object
Methods defined here:
- __init__(self, argPerfTab, quantiles=None, quantilesOrderingStrategy='average', LowerClosed=False, componentRankingRule='Copeland', minimalComponentSize=1, distribution='triangular', betaParameter=2, confidence=90.0, Threading=False, startMethod=None, tempDir=None, nbrOfCPUs=None, nbrOfThreads=0, save2File=None, CopyPerfTab=True, Comments=False, Debug=False)
- Constructor
- computeCLTLikelihoods(self, distribution='triangular', betaParameter=None, Debug=False)
- Renders the pairwise CLT likelihood of the at least as good as relation
neglecting all considerable large performance differences polarisations.
- showRelationTable(self, IntegerValues=False, actionsSubset=None, Sorted=True, LikelihoodDenotation=True, hasLatexFormat=False, hasIntegerValuation=False, relation=None, Debug=False)
- prints the relation valuation in actions X actions table format.
Methods inherited from PreRankedOutrankingDigraph:
- actionOrder(self, action, ordering=None)
- Renders the order of a decision action in a given ordering
If ordering is None, the self.boostedOrder attribute is used.
- actionRank(self, action, ranking=None)
- Renders the rank of a decision action in a given ranking
If ranking is None, the self.boostedRanking attribute is used.
- computeActionCategories(self, action, Show=False, Debug=False, Comments=False, Threading=False, nbrOfCPUs=None, startMethod=None)
- Renders the union of categories in which the given action is sorted positively or null into.
Returns a tuple : action, lowest category key, highest category key, membership credibility !
- computeBoostedOrdering(self, orderingRule='Copeland')
- Renders an ordred list of decision actions ranked in
increasing preference direction following the orderingRule
on each component.
- computeBoostedRanking(self, rankingRule='Copeland')
- Renders an ordred list of decision actions ranked in
decreasing preference direction following the rankingRule
on each component.
- computeCategoryContents(self, Reverse=False, Comments=False, StoreSorting=True, Threading=False, nbrOfCPUs=None, startMethod=None)
- Computes the sorting results per category.
- computeCriterion2RankingCorrelation(self, criterion, Threading=False, nbrOfCPUs=None, startMethod=None, Debug=False, Comments=False)
- Renders the ordinal correlation coefficient between
the global linar ranking and the marginal criterion relation.
- computeMarginalVersusGlobalRankingCorrelations(self, Sorted=True, ValuedCorrelation=False, Threading=False, nbrCores=None, startMethod=None, Comments=False)
- Method for computing correlations between each individual criterion relation with the corresponding global ranking relation.
Returns a list of tuples (correlation,criterionKey) sorted by default in decreasing order of the correlation.
If Threading is True, a multiprocessing Pool class is used with a parallel equivalent of the built-in map function.
If nbrCores is not set, the os.cpu_count() function is used to determine the number of available cores.
- computeNewActionCategories(self, action, sorting, Debug=False, Comments=False)
- Renders the union of categories in which the given action is sorted positively or null into.
Returns a tuple : action, lowest category key, highest category key, membership credibility !
- computeNewSortingCharacteristics(self, actions, relation, Comments=False)
- Renders a bipolar-valued bi-dictionary relation
representing the degree of credibility of the
assertion that "actions x in A belongs to category c in C",
i.e. x outranks low category limit and does not outrank
the high category limit (if LowerClosed).
- showActionSortingResult(self, action)
- shows the quantiles sorting result all (default) of a subset of the decision actions.
- showActions(self)
- Prints out the actions disctionary.
- showComponents(self, direction='increasing')
- Shows the list of connected components of the digraph instance.
- showCriteria(self, IntegerWeights=False, Debug=False)
- print Criteria with thresholds and weights.
- showCriteriaQuantiles(self)
- showDecomposition(self, direction='decreasing')
- Prints on the console the decomposition structure of the sparse outranking digraph instance
in *decreasing* (default) or *increasing* preference direction.
- showMarginalVersusGlobalRankingCorrelation(self, Sorted=True, Threading=False, nbrOfCPUs=None, startMehod=None, Comments=True)
- Show method for computeCriterionCorrelation results.
- showNewActionCategories(self, action, sorting)
- Prints the union of categories in which the given action is sorted positively or null into.
- showNewActionsSortingResult(self, actions, sorting, Debug=False)
- shows the quantiles sorting result all (default) of a subset of the decision actions.
- showShort(self, fileName=None, WithFileSize=True)
- Default (__repr__) presentation method for big outranking digraphs instances:
>>> from sparseOutrankingDigraphs import *
>>> t = RandomCBPerformanceTableau(numberOfActions=100,seed=1)
>>> g = PreRankedOutrankingDigraph(t,quantiles=10)
>>> print(g)
*----- show short --------------*
Instance name : randomCBperftab_mp
Actions : 100
Criteria : 7
Sorting by : 10-Tiling
Ordering strategy : average
Ranking rule : Copeland
Components : 19
Minimal size : 1
Maximal size : 22
Median size : 2
fill rate : 0.116
---- Constructor run times (in sec.) ----
Total time : 0.14958
QuantilesSorting : 0.06847
Preordering : 0.00071
Decomposing : 0.07366
Ordering : 0.00130
- showSorting(self, Descending=True, isReturningHTML=False, Debug=False)
- Shows sorting results in decreasing or increasing (Reverse=False)
order of the categories. If isReturningHTML is True (default = False)
the method returns a htlm table with the sorting result.
Methods inherited from SparseOutrankingDigraph:
- __repr__(self)
- Default presentation method for pre-ranked sparse digraphs instances.
- computeDecompositionSummaryStatistics(self)
- Returns the summary of the distribution of the length of
the components as follows::
summary = {'max': maxLength,
'median':medianLength,
'mean':meanLength,
'stdev': stdLength,
'fillrate': fillrate,
(see computeFillRate()}
- computeDeterminateness(self)
- Computes the Kendalll distance in % of self
with the all median valued (indeterminate) digraph.
- computeFillRate(self)
- Renders the sum of the squares (without diagonal) of the orders of the component's subgraphs
over the square (without diagonal) of the big digraph order.
- computeOrderCorrelation(self, order, Debug=False)
- Renders the ordinal correlation K of a sparse digraph instance
when compared with a given linear order (from worst to best) of its actions
K = sum_{x != y} [ min( max(-self.relation(x,y)),other.relation(x,y), max(self.relation(x,y),-other.relation(x,y)) ]
K /= sum_{x!=y} [ min(abs(self.relation(x,y),abs(other.relation(x,y)) ]
.. note::
Renders a dictionary with the key 'correlation' containing the actual bipolar correlation index and the key 'determination' containing the minimal determination level D of self and the other relation.
D = sum_{x != y} min(abs(self.relation(x,y)),abs(other.relation(x,y)) / n(n-1)
where n is the number of actions considered.
The correlation index with a completely indeterminate relation
is by convention 0.0 at determination level 0.0 .
.. warning::
self must be a normalized outranking digraph instance !
- computeOrdinalCorrelation(self, other, Debug=False)
- Renders the ordinal correlation K of a SpareOutrakingDigraph instance
when compared with a given compatible (same actions set) other Digraph instance.
K = sum_{x != y} [ min( max(-self.relation(x,y)),other.relation(x,y), max(self.relation(x,y),-other.relation(x,y)) ]
K /= sum_{x!=y} [ min(abs(self.relation(x,y),abs(other.relation(x,y)) ]
.. note::
The global outranking relation of SparesOutrankingDigraph instances is contructed on the fly
from the ordered dictionary of the components.
Renders a dictionary with a 'correlation' key containing the actual bipolar correlation index K and a 'determination' key containing the minimal determination level D of self and the other relation, where
D = sum_{x != y} min(abs(self.relation(x,y)),abs(other.relation(x,y)) / n(n-1)
and where n is the number of actions considered.
The correlation index K with a completely indeterminate relation
is by convention 0.0 at determination level 0.0 .
- estimateRankingCorrelation(self, sampleSize=100, seed=1, Debug=False)
- exportGraphViz(self, fileName=None, actionsSubset=None, direction='decreasing', Comments=True, graphType='pdf', graphSize='7,7', fontSize=10, bgcolor='cornsilk', relation=None, Debug=False)
- Dummy for exportSortingDigraph.
- exportSortingGraphViz(self, fileName=None, actionsSubset=None, direction='decreasing', Comments=True, graphType='pdf', graphSize='7,7', fontSize=10, bgcolor='cornsilk', relation=None, Debug=False)
- export GraphViz dot file for weak order (Hasse diagram) drawing
filtering from SortingDigraph instances.
Example::
>>> # Testing graph viz export of sorting Hasse diagram
>>> MP = True
>>> nbrActions=100
>>> tp = RandomCBPerformanceTableau(numberOfActions=nbrActions,
... Threading=MP,
... seed=100)
>>> bg = PreRankedOutrankingDigraph(tp,CopyPerfTab=True,quantiles=20,
... quantilesOrderingStrategy='average',
... componentRankingRule='Copeland',
... LowerClosed=False,
... minimalComponentSize=1,
... Threading=MP,nbrOfCPUs=8,
... #tempDir='.',
... nbrOfThreads=8,
... Comments=False,Debug=False)
>>> print(bg)
*----- show short --------------*
Instance name : randomCBperftab_mp
# Actions : 100
# Criteria : 7
Sorting by : 20-Tiling
Ordering strategy : average
Ranking rule : Copeland
# Components : 36
Minimal order : 1
Maximal order : 11
Average order : 2.8
fill rate : 4.121%
---- Constructor run times (in sec.) ----
Total time : 0.15991
QuantilesSorting : 0.11717
Preordering : 0.00066
Decomposing : 0.04009
Ordering : 0.00000
>>> bg.showComponents()
*--- Relation decomposition in increasing order---*
35: ['a010']
34: ['a024', 'a060']
33: ['a012']
32: ['a018']
31: ['a004', 'a054', 'a075', 'a082']
30: ['a099']
29: ['a065']
28: ['a025', 'a027', 'a029', 'a041', 'a059']
27: ['a063']
26: ['a047', 'a066']
25: ['a021']
24: ['a007']
23: ['a044']
22: ['a037', 'a062', 'a090', 'a094', 'a098', 'a100']
21: ['a005', 'a040', 'a051', 'a093']
20: ['a015', 'a030', 'a052', 'a055', 'a064', 'a077']
19: ['a006', 'a061']
18: ['a049']
17: ['a001', 'a033']
16: ['a016', 'a028', 'a032', 'a035', 'a057', 'a079', 'a084', 'a095']
15: ['a043']
14: ['a002', 'a017', 'a023', 'a034', 'a067', 'a072', 'a073', 'a074', 'a088', 'a089', 'a097']
13: ['a048']
12: ['a078', 'a092']
11: ['a070']
10: ['a014', 'a026', 'a039', 'a058', 'a068', 'a083', 'a086']
9: ['a008', 'a022', 'a038', 'a081', 'a091', 'a096']
8: ['a020']
7: ['a069']
6: ['a045']
5: ['a003', 'a009', 'a013', 'a031', 'a036', 'a056', 'a076']
4: ['a042', 'a071']
3: ['a085']
2: ['a019', 'a080', 'a087']
1: ['a046']
0: ['a011', 'a050', 'a053']
>>> bg.exportSortingGraphViz(actionsSubset=bg.boostedRanking[:100])
.. image:: preRankedDigraph.png
:alt: pre-ranked digraph
:width: 400 px
:align: center
- htmlRelationMap(self, actionsSubset=None, tableTitle='Relation Map', relationName='r(x R y)', symbols=['+', '·', ' ', '-', '_'], Colored=True, ContentCentered=True)
- renders the relation map in actions X actions html table format.
- ordering2Preorder(self, ordering)
- Renders a preordering (a list of list) of a linar order (worst to best) of decision actions in increasing preference direction.
- ranking2Preorder(self, ranking)
- Renders a preordering (a list of list) of a ranking (best to worst) of decision actions in increasing preference direction.
- recodeValuation(self, newMin=-1, newMax=1, Debug=False)
- Specialization for recoding the valuation of all the partial digraphs and the component relation.
By default the valuation domain is normalized to [-1;1]
- relation(self, x, y, Debug=False)
- Dynamic construction of the global outranking characteristic function *r(x S y)*.
- showBestChoiceRecommendation(self, Comments=False, ChoiceVector=False, Debug=False)
- *Parameters*:
* Comments=False,
* ChoiceVector=False,
* Debug=False.
Update of rubisBestChoice Recommendation for big digraphs.
To do: limit to best choice; worst choice should be a separate method()
- showHTMLMarginalQuantileLimits(self, htmlFileName=None)
- shows the marginal quantiles limits.
- showHTMLRelationMap(self, actionsSubset=None, Colored=True, tableTitle='Relation Map', relationName='r(x S y)', symbols=['+', '·', ' ', '–', '—'], htmlFileName=None)
- Launches a browser window with the colored relation map of self.
- showHTMLRelationTable(self, actionsList=None, IntegerValues=False, ndigits=2, Colored=True, tableTitle='Valued Sparse Relation Table', relationName='r(x,y)', ReflexiveTerms=False, fromIndex=None, toIndex=None, htmlFileName=None)
- Launches a browser window with the colored relation table of self.
- showRelationMap(self, fromIndex=None, toIndex=None, symbols=None, actionsList=None)
- Prints on the console, in text map format, the location of
the diagonal outranking components of the sparse outranking digraph.
By default, symbols = {'max':'┬','positive': '+', 'median': ' ',
'negative': '-', 'min': '┴'}
Example::
>>> from sparseOutrankingDigraphs import *
>>> t = RandomCBPerformanceTableau(numberOfActions=50,seed=1)
>>> bg = PreRankedOutrankingDigraph(t,quantiles=10,minimalComponentSize=5)
>>> print(bg)
*----- show short --------------*
Instance name : randomCBperftab_mp
# Actions : 50
# Criteria : 7
Sorting by : 10-Tiling
Ordering strategy : average
Ranking Rule : Copeland
# Components : 7
Minimal size : 5
Maximal size : 13
Median size : 6
fill rate : 16.898%
---- Constructor run times (in sec.) ----
Total time : 0.08494
QuantilesSorting : 0.04339
Preordering : 0.00034
Decomposing : 0.03989
Ordering : 0.00024
>>> bg.showRelationMap()
┬+++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴ ++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
+ ++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
--- -┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
-┴-+ ┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴ ┬-+┬+┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴ +┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴+ + ┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴-+- ++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴ + ┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴ - ┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴ +++-+++++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴+ +++++++++-+┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴+- +--+++++++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴--+ -++++++-+┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴++++ +- ++ ┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴--+-+ +++++++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴-+-++- ++++--┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴-++-++- + -+-┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴---- ++- + ++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴-+--++++- -++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴--- --+++ ++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴+-+-++-+-+ +┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴-+- -+++-++ ┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ - + + ┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ -+ + ++┬++┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴++ +++++++++┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ -- -+-++ ┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴++++ ++++++-┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴----- ++-┬+┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ +++- -++-+┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴-----++ -++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ +-+-+-+ -++┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴+ +++ ┬+┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴-- --+++ -┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴--┴+ -┴--+ ┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ +++++++┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴+ +++-+┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴-- +++┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴-- ++┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴+-+ +++┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ +- + --┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴---+++ +┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴- ┴-+++ ┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ ┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ ++ ┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ - -┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ -+ ┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ ┴ ┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴
Component ranking rule: Copeland
>>>
- showRubisBestChoiceRecommendation(self, Comments=False, ChoiceVector=False, Debug=False)
- Dummy for self.showBestChoiceRecommendation() method.
- sortingRelation(self, x, y, Debug=False)
- Dynamic construction of the quantiles sorting characteristic function *r(x QS y)*.
Methods inherited from outrankingDigraphs.BipolarOutrankingDigraph:
- computeCriterionRelation(self, c, a, b, hasSymmetricThresholds=True)
- Compute the outranking characteristic for actions x and y
on criterion c.
- computeSingleCriteriaNetflows(self)
- renders the Promethee single criteria netflows matrix M
- criterionCharacteristicFunction(self, c, a, b, hasSymmetricThresholds=True)
- Renders the characteristic value of the comparison of a and b on criterion c.
- saveSingleCriterionNetflows(self, fileName='tempnetflows.prn', delimiter=' ', Comments=True)
- Delimited save of single criteria netflows matrix
Methods inherited from outrankingDigraphs.OutrankingDigraph:
- computeAMPLData(self, OldValuation=False)
- renders the ampl data list
- computeActionsComparisonCorrelations(self)
- renders the comparison correlations between the actions
- computeActionsCorrelationDigraph(self)
- renders the pairwise actions comparison digraph
- computeCriteriaComparisonCorrelations(self)
- renders the comparison correlations between the criteria
- computeCriteriaCorrelationDigraph(self, ValuedCorrelation=True, WithMedian=False)
- renders the ordinal criteria correlation digraph.
- computeCriteriaCorrelations(self, ValuedCorrelation=False)
- renders the relation equivalence or correlation between the criteria
- computeCriterionCorrelation(self, criterion, Threading=False, nbrOfCPUs=None, Debug=False, Comments=False)
- Renders the ordinal correlation coefficient between
the global outranking and the marginal criterion relation.
Uses the digraphs.computeOrdinalCorrelationMP().
.. note::
Renders a dictionary with the key 'correlation' containing the actual bipolar correlation index and the key 'determination' containing the minimal determination level D of the self outranking and the marginal criterion relation.
D = sum_{x != y} min(abs(self.relation(x,y)),abs(marginalCriterionRelation(x,y)) / n(n-1)
where n is the number of actions considered.
The correlation index with a completely indeterminate relation
is by convention 0.0 at determination level 0.0 .
- computeMarginalCorrelation(self, args, Threading=False, nbrOfCPUs=None, Debug=False, Comments=False)
- Renders the ordinal correlation coefficient between
the marginal criterion relation and a
given normalized outranking relation.
args = (criterion,relation)
- computeMarginalObjectiveCorrelation(self, args, Threading=False, nbrOfCPUs=None, Debug=False, Comments=False)
- Renders the ordinal correlation coefficient between
the marginal criterion relation and a
given normalized outranking relation.
args = (objective,relation)
- computeMarginalObjectivesVersusGlobalRankingCorrelations(self, ranking, Sorted=True, ValuedCorrelation=False, Threading=False, nbrCores=None, startMethod=None, Comments=False)
- Method for computing correlations between each individual objective's outranking relation and the given global ranking relation.
Returns a list of tuples (correlation,objectiveKey) sorted by default in decreasing order of the correlation.
If Threading is True, a multiprocessing Pool class is used with a parallel equivalent of the built-in map function.
If nbrCores is not set, the os.cpu_count() function is used to determine the number of available cores.
*Usage example*:
>>> from outrankingDigraphs import *
>>> t = Random3ObjectivesPerformanceTableau(
numberOfActions=21,
numberOfCriteria=17,
vetoProbability=0.2,
seed=12)
>>> g = BipolarOutrankingDigraph(t)
>>> ranking = g.computeNetFlowsRanking()
>>> g.computeMarginalObjectivesVersusGlobalRankingCorrelations(
ranking,Threading=False,Comments=True)
Marginal objective ordinal correlation with given ranking
-------------------------------------------------
Given ranking: ['p04', 'p09', 'p01', 'p08', 'p16', 'p03',
'p13', 'p20', 'p15', 'p10', 'p18', 'p19',
'p06', 'p02', 'p07', 'p11', 'p05', 'p12',
'p14', 'p21', 'p17']
Objective (weight): correlation
Soc (135.00): +0.473
Eco (135.00): +0.457
Env (135.00): +0.326
- computeMarginalVersusGlobalOutrankingCorrelations(self, Sorted=True, ValuedCorrelation=False, Threading=False, nbrCores=None, startMethod=None, Comments=False)
- Method for computing correlations between each individual criterion relation with the corresponding
global outranking relation.
Returns a list of tuples (correlation,criterionKey) sorted by default in decreasing order of the correlation.
If Threading is True, a multiprocessing Pool class is used with a parallel equivalent of the built-in map function.
If nbrCores is not set, the os.cpu_count() function is used to determine the number of
available cores.
- computeOutrankingConsensusQuality(self, Sorted=True, ValuedCorrelation=True, Threading=False, nbrCores=None, Comments=False)
- Renders the marginal criteria correlations with the corresponding global outranking relation with summary.
- computePairwiseComparisons(self, hasSymmetricThresholds=True)
- renders pairwise comparison parameters for all pairs of actions
- computePairwiseCompleteComparison(self, a, b, c)
- renders pairwise complete comparison parameters for actions a and b
on criterion c.
- computePairwiseOddsMatrix(self)
- renders a double dictionary with odds:
(positive chaacteristics, negative characteristics)
per actions pair.
- computeQuantileSortRelation(self, Debug=False)
- Renders the bipolar-valued relation obtained from
the self quantile sorting result.
- computeSingletonRanking(self, Comments=False, Debug=False)
- Renders the sorted bipolar net determinatation of outrankingness
minus outrankedness credibilities of all singleton choices.
res = ((netdet,singleton,dom,absorb)+)
- computeVetoesStatistics(self, level=None)
- renders the cut level vetos in dictionary format:
vetos = {'all': n0, 'strong: n1, 'weak':n2}.
- computeVetosShort(self)
- renders the number of vetoes and real vetoes in an OutrankingDigraph.
- computeWeightsConcentrationIndex(self)
- Renders the Gini concentration index of the weight distribution
Based on the triangle summation formula.
- defaultDiscriminationThresholds(self, quantile={'ind': 10, 'pref': 20, 'weakVeto': 60, 'veto': 80}, Debug=False, comments=False)
- updates the discrimination thresholds with the percentiles
from the performance differences.
Parameters:
quantile = {'ind': 10, 'pref': 20, 'weakVeto': 60, 'veto: 80}.
- export3DplotOfActionsCorrelation(self, plotFileName='actCorr', graphType=None, pictureFormat='pdf', bgcolor='cornsilk', Comments=False)
- Using R for producing a plot -pdf format by default- of the principal components of
the actions ordinal correlation table.
See export3DplotCriteriaCorrelation()
- export3DplotOfCriteriaCorrelation(self, plotFileName='critCorr', tempDir='.', graphType=None, pictureFormat='pdf', bgcolor='cornsilk', ValuedCorrelation=False, WithMedian=False, Comments=False)
- Using R for producing a plot (pdf format by default) of the principal components of
the criteria ordinal correlation table.
*Parameters*:
* *plotFileName* := name of the created R plot image,
* *pictureFormat* := 'png' (default) | 'pdf' | 'jpeg' | 'xfig',
* *graphType* := deprecated
* *bgcolor* := 'cornsilk' by default | None,
* *ValuedCorrelation* := False (tau by default) | True (r(<=>) otherwise,
* *WithMedian* includes the marginal correlation with the global outranking relation
* *tempDir* := '.' : default current working directory.
- saveActionsCorrelationTable(self, fileName='tempcorr.prn', delimiter=' ', Bipolar=True, Silent=False, Centered=False)
- Delimited save of correlation table
- saveCriteriaCorrelationTable(self, fileName='tempcorr.prn', delimiter=' ', ValuedCorrelation=False, Bipolar=True, Silent=False, Centered=False)
- Delimited save of correlation table
- saveXMCDA2RubisChoiceRecommendation(self, fileName='temp', category='Rubis', subcategory='Choice Recommendation', author='digraphs Module (RB)', reference='saved from Python', comment=True, servingD3=False, relationName='Stilde', graphValuationType='bipolar', variant='standard', instanceID='void', stringNA='NA', _OldCoca=True, Debug=False)
- save complete Rubis problem and result in XMCDA 2.0 format with unicode encoding.
*Warning*: obsolete now!
- showAll(self)
- specialize the general showAll method with criteria
and performance tableau output
- showConsiderablePerformancesPolarisation(self)
- prints all considerable performance polarisations.
- showCriteriaCorrelationTable(self, ValuedCorrelation=False, isReturningHTML=False, ndigits=3)
- prints the ordinal correlation index tau between criteria in table format.
- showCriteriaHierarchy(self)
- shows the Rubis clustering of the ordinal criteria correlation table
- showCriterionRelationTable(self, criterion, actionsSubset=None)
- prints the relation valuation in actions X actions table format.
- showHTMLPairwiseComparison(self, a, b, htmlFileName=None)
- Exporting the pairwise comparison table of actions a and b in the default system browser. A specific file name may be provided.
- showHTMLPairwiseOutrankings(self, a, b, htmlFileName=None)
- Exporting the pairwise outrankings table of actions a and b
in the default system browser. A specific file name may be provided.
- showMarginalObjectivesVersusGlobalRankingCorrelations(self, ranking, Sorted=True, ValuedCorrelation=False, Threading=False, nbrCores=None)
- Corresponding compute method with Comments = True flag.
- showMarginalVersusGlobalOutrankingCorrelation(self, Sorted=True, ValuedCorrelation=False, Threading=False, nbrOfCPUs=None, Comments=True)
- Show method for computeCriterionCorrelation results.
- showOldPairwiseComparison(self, a, b, Debug=False, isReturningHTML=False, hasSymmetricThresholds=True)
- Obsolete: Renders the pairwise comprison parameters on all criteria
with weak preference and weak veto thresholds.
- showOutrankingConsensusQuality(self, Sorted=True, ValuedCorrelation=True, Threading=False, nbrCores=None, Comments=True)
- Show method for the computeOutrankingConsensusQuality() method.
- showPairwiseComparison(self, a, b, Debug=False, isReturningHTML=False, hasSymmetricThresholds=True)
- Renders the pairwise comprison parameters on all criteria
in html format
- showPairwiseComparisonsDistributions(self)
- Renders the lt,leq, eq, geq, gt distributions for all pairs
- showPairwiseOutrankings(self, a, b, Debug=False, isReturningHTML=False, hasSymmetricThresholds=True)
- Renders the pairwise outrankings table for actions *a* and *b*.
- showPerformanceTableau(self, actionsSubset=None)
- Print the performance Tableau.
- showPolarisations(self, cutLevel=None, realVetosOnly=False)
- prints all negative and positive polarised situations observed in the OutrankingDigraph instance.
- showSingletonRanking(self, Comments=True, Debug=False)
- Calls self.computeSingletonRanking(comments=True,Debug = False).
Renders and prints the sorted bipolar net determinatation of outrankingness
minus outrankedness credibilities of all singleton choices.
res = ((netdet,sigleton,dom,absorb)+)
- showVetos(self, cutLevel=None, realVetosOnly=False)
- prints all veto and counter-veto situations observed in the OutrankingDigraph instance.
Methods inherited from digraphs.Digraph:
- MISgen(self, S, I)
- generator of maximal independent choices (voir Byskov 2004):
* S ::= remaining nodes;
* I ::= current independent choice
.. note::
Inititalize: self.MISgen(self.actions.copy(),set())
- __invert__(self)
- Make the inverting operator ~self available for Digraph instances.
Returns a ConverseDigraph instance of self.
- __neg__(self)
- Make the negation operator -self available for Digraph instances.
Returns a DualDigraph instance of self.
- absirred(self, choice)
- Renders the crips -irredundance degree of a choice.
- absirredundant(self, U)
- Generates all -irredundant choices of a digraph.
- absirredval(self, choice, relation)
- Renders the valued -irredundance degree of a choice.
- absirredx(self, choice, x)
- Computes the crips -irredundance degree of node x in a choice.
- abskernelrestrict(self, prekernel)
- Parameter: prekernel
Renders absorbent prekernel restricted relation.
- absorb(self, choice)
- Renders the absorbency degree of a choice.
- absorbentChoices(self, S)
- Generates all minimal absorbent choices of a bipolar valued digraph.
- addValuationAttribute(self)
- Adds the numpy valuation attribute
- agglomerationDistribution(self)
- Output: aggloCoeffDistribution, meanCoeff
Renders the distribution of agglomeration coefficients.
- aneighbors(self, node)
- Renders the set of absorbed in-neighbors of a node.
- automorphismGenerators(self)
- Adds automorphism group generators to the digraph instance.
.. note::
Dependency: Uses the dreadnaut command from the nauty software package. See https://www3.cs.stonybrook.edu/~algorith/implement/nauty/implement.shtml
On Ubuntu Linux:
...$ sudo apt-get install nauty
- averageCoveringIndex(self, choice, direction='out')
- Renders the average covering index of a given choice in a set of objects,
ie the average number of choice members that cover each
non selected object.
- bipolarKCorrelation(self, digraph, Debug=False)
- Renders the bipolar Kendall correlation between two bipolar valued
digraphs computed from the average valuation of the
XORDigraph(self,digraph) instance.
.. warning::
Obsolete! Is replaced by the self.computeBipolarCorrelation(other) Digraph method
- bipolarKDistance(self, digraph, Debug=False)
- Renders the bipolar crisp Kendall distance between two bipolar valued
digraphs.
.. warning::
Obsolete! Is replaced by the self.computeBipolarCorrelation(other, MedianCut=True) Digraph method
- chordlessPaths(self, Pk, n2, Odd=False, Comments=False, Debug=False)
- New procedure from Agrum study April 2009
recursive chordless path extraction starting from path
Pk = [n2, ...., n1] and ending in node n2.
Optimized with marking of visited chordless P1s.
- circuitAverageCredibility(self, circ)
- Renders the average linking credibility of a Chordless Circuit.
- circuitCredibilities(self, circuit, Debug=False)
- Renders the average linking credibilities and the minimal link of a Chordless Circuit.
- circuitMaxCredibility(self, circ)
- Renders the maximal linking credibility of a Chordless Circuit.
- circuitMinCredibility(self, circ)
- Renders the minimal linking credibility of a Chordless Circuit.
- closeSymmetric(self, InSite=True)
- Produces the symmetric closure of self.relation.
- closeTransitive(self, Reverse=False, InSite=True, Comments=False)
- Produces the transitive closure of self.relation.
*Parameters*:
- If *Reverse* == True (False default) all transitive links are dropped, otherwise all transitive links are closed with min[r(x,y),r(y,z)];
- If *Insite* == False (True by default) the methods return a modified copy of self.relation without altering the original self.relation, otherwise self.relation is modified.
- components(self)
- Renders the list of connected components.
- computeAllDensities(self, choice=None)
- parameter: choice in self
renders six densitiy parameters:
arc density, double arc density,
single arc density, strict single arc density,
absence arc density, strict absence arc densitiy.
- computeArrowRaynaudOrder(self)
- Renders a linear ordering from worst to best of the actions following Arrow&Raynaud's rule.
- computeArrowRaynaudRanking(self)
- renders a linear ranking from best to worst of the actions following Arrow&Raynaud's rule.
- computeAverageValuation(self)
- Computes the bipolar average correlation between
self and the crisp complete digraph of same order
of the irreflexive and determined arcs of the digraph
- computeBadChoices(self, Comments=False)
- Computes characteristic values for potentially bad choices.
.. note::
Returns a tuple with following content:
[(0)-determ,(1)degirred,(2)degi,(3)degd,(4)dega,(5)str(choice),(6)absvec]
- computeBadPirlotChoices(self, Comments=False)
- Characteristic values for potentially bad choices
using the Pirlot's fixpoint algorithm.
- computeBestChoiceRecommendation(self, Verbose=False, Comments=False, ChoiceVector=False, CoDual=True, Debug=False, _OldCoca=False, BrokenCocs=True)
- Sets self.bestChoice, self.bestChoiceData, self.worstChoice and self.worstChoiceData
with the showBestChoiceRecommendation method.
First and last choices data is the following:
[(0)-determ,(1)degirred,(2)degi,(3)degd,(4)dega,(5)str(choice),(6)domvec,(7)cover]
self.bestChoice = self.bestChoiceData[5]
self.worstChoice = self.worstChoiceData[5]
- computeBipolarCorrelation(self, other, MedianCut=False, filterRelation=None, Debug=False)
- obsolete: dummy replacement for Digraph.computeOrdinalCorrelation method
- computeChordlessCircuits(self, Odd=False, Comments=False, Debug=False)
- Renders the set of all chordless circuits detected in a digraph.
Result is stored in <self.circuitsList>
holding a possibly empty list of tuples with at position 0 the
list of adjacent actions of the circuit and at position 1
the set of actions in the stored circuit.
When *Odd* is True, only chordless circuits with an odd length
are collected.
- computeChordlessCircuitsMP(self, Odd=False, Threading=False, nbrOfCPUs=None, startMethod=None, Comments=False, Debug=False)
- Multiprocessing version of computeChordlessCircuits().
Renders the set of all chordless odd circuits detected in a digraph.
Result (possible empty list) stored in <self.circuitsList>
holding a possibly empty list tuples with at position 0 the
list of adjacent actions of the circuit and at position 1
the set of actions in the stored circuit.
Inspired by Dias, Castonguay, Longo, Jradi, Algorithmica (2015).
Returns a possibly empty list of tuples (circuit,frozenset(circuit)).
If Odd == True, only circuits of odd length are retained in the result.
- computeCoSize(self)
- Renders the number of non validated non reflexive arcs
- computeConcentrationIndex(self, X, N)
- Renders the Gini concentration index of the X serie.
N contains the partial frequencies.
Based on the triangle summation formula.
- computeConcentrationIndexTrapez(self, X, N)
- Renders the Gini concentration index of the X serie.
N contains the partial frequencies.
Based on the triangles summation formula.
- computeCondorcetLosers(self)
- Wrapper for condorcetLosers().
- computeCondorcetWinners(self)
- Wrapper for condorcetWinners().
- computeCopelandOrder(self)
- renders a linear ordering from worst to best of the actions following Arrow&Raynaud's rule.
- computeCopelandRanking(self)
- renders a linear ranking from best to worst of the actions following Arrow&Raynaud's rule.
- computeCutLevelDensities(self, choice, level)
- parameter: choice in self, robustness level
renders three robust densitiy parameters:
robust double arc density,
robust single arc density,
robust absence arc densitiy.
- computeDensities(self, choice)
- parameter: choice in self
renders the four densitiy parameters:
arc density, double arc density, single arc density, absence arc density.
- computeDiameter(self, Oriented=True)
- Renders the (by default oriented) diameter of the digraph instance
- computeDigraphCentres(self, WeakDistances=False, Comments=False)
- The centers of a digraph are the nodes with finite minimal shortes path lengths.
The maximal neighborhood distances are stored in *self.maximalNeighborhoodDistances*.
The corresponding digraph radius and diameter are stored respectively in *self.radius* and *self.diameter*.
With *Comments* = True, all these results are printed out.
*Source*: Claude Berge, *The Theory of Graphs*, Dover (2001) pp. 119, original in French Dunod (1958)
- computeDynamicProgrammingStages(self, source, sink, Debug=False)
- Renders the discrete stages of the optimal substructure for
dynamic pogramming digrahs from a given source node
to a given sink sink node.
Returns a list of list of action identifyers.
- computeGoodChoiceVector(self, ker, Comments=False)
- | Computing Characteristic values for dominant pre-kernels
| using the von Neumann dual fixoint equation
- computeGoodChoices(self, Comments=False)
- Computes characteristic values for potentially good choices.
..note::
Return a tuple with following content:
[(0)-determ,(1)degirred,(2)degi,(3)degd,(4)dega,(5)str(choice),(6)domvec,(7)cover]
- computeGoodPirlotChoices(self, Comments=False)
- Characteristic values for potentially good choices
using the Pirlot fixpoint algorithm.
- computeIncomparabilityDegree(self, InPercents=False, Comments=False)
- Renders the incomparability degree (Decimal), i.e. the relative number of symmetric indeterminate relations of the irreflexive part of a digraph.
- computeKemenyIndex(self, otherRelation)
- renders the Kemeny index of the self.relation
compared with a given crisp valued relation of a compatible
other digraph (same nodes or actions).
- computeKemenyOrder(self, orderLimit=7, Debug=False)
- Renders a ordering from worst to best of the actions with maximal Kemeny index.
Return a tuple: kemenyOrder (from worst to best), kemenyIndex
- computeKemenyRanking(self, orderLimit=7, seed=None, sampleSize=1000, Debug=False)
- Renders a ranking from best to worst of the actions with maximal Kemeny index.
.. note::
Returns a tuple: kemenyRanking (from best to worst), kemenyIndex.
- computeKernelVector(self, kernel, Initial=True, Comments=False)
- | Computing Characteristic values for dominant pre-kernels
| using the von Neumann dual fixpoint equation
- computeKohlerOrder(self)
- Renders an ordering (worst to best) of the actions following Kohler's rule.
- computeKohlerRanking(self)
- Renders a ranking (best to worst) of the actions following Kohler's rule.
- computeMaxHoleSize(self, Comments=False)
- Renders the length of the largest chordless cycle
in the corresponding disjunctive undirected graph.
- computeMeanInDegree(self)
- Renders the mean indegree of self.
!!! self.size must be set previously !!!
- computeMeanOutDegree(self)
- Renders the mean degree of self.
!!! self.size must be set previously !!!
- computeMeanSymDegree(self)
- Renders the mean degree of self.
!!! self.size must be set previously !!!
- computeMedianOutDegree(self)
- Renders the median outdegree of self.
!!! self.size must be set previously !!!
- computeMedianSymDegree(self)
- Renders the median symmetric degree of self.
!!! self.size must be set previously !!!
- computeMoreOrLessUnrelatedPairs(self)
- Renders a list of more or less unrelated pairs.
- computeNetFlowsOrder(self)
- Renders an ordered list (from best to worst) of the actions
following the net flows ranking rule.
- computeNetFlowsOrderDict(self)
- Renders an ordered list (from worst to best) of the actions
following the net flows ranking rule.
- computeNetFlowsRanking(self)
- Renders an ordered list (from best to worst) of the actions
following the net flows ranking rule.
- computeNetFlowsRankingDict(self)
- Renders an ordered list (from best to worst) of the actions
following the net flows ranking rule.
- computeODistance(self, op2, comments=False)
- renders the squared normalized distance of
two digraph valuations.
.. note::
op2 = digraphs of same order as self.
- computeOrbit(self, choice, withListing=False)
- renders the set of isomorph copies of a choice following
the automorphism of the digraph self
- computeOrdinalCorrelationMP(self, other, MedianCut=False, Threading=False, nbrOfCPUs=None, startMethod=None, Comments=False, Debug=False)
- Multi processing version of the digraphs.computeOrdinalCorrelation() method.
.. note::
The relation filtering and the MedinaCut option are not implemented in the MP version.
- computePairwiseClusterComparison(self, K1, K2, Debug=False)
- Computes the pairwise cluster comparison credibility vector
from bipolar-valued digraph g. with K1 and K2 disjoint
lists of action keys from g actions disctionary.
Returns the dictionary
{'I': Decimal(),'P+':Decimal(),'P-':Decimal(),'R' :Decimal()}
where one and only one item is strictly positive.
- computePreKernels(self)
- computing dominant and absorbent preKernels:
Result in self.dompreKernels and self.abspreKernels
- computePreRankingRelation(self, preRanking, Normalized=True, Debug=False)
- Renders the bipolar-valued relation obtained from
a given preRanking in decreasing levels (list of lists) result.
- computePreorderRelation(self, preorder, Normalized=True, Debug=False)
- Renders the bipolar-valued relation obtained from
a given preordering in increasing levels (list of lists) result.
- computePrincipalOrder(self, Colwise=False, Comments=False)
- Rendesr an ordering from wrost to best of the decision actions.
- computePrincipalRanking(self, Colwise=False, Comments=False)
- Rendesr a ranking from best to worst of the decision actions.
- computePrincipalScores(self, plotFileName=None, Colwise=False, imageType=None, tempDir=None, bgcolor='cornsilk', Comments=False, Debug=False)
- Renders a ordered list of the first principal eigenvector of the covariance of the valued outdegrees of self.
.. note::
The method, relying on writing and reading temporary files by default in a temporary directory is threading and multiprocessing safe !
(see Digraph.exportPrincipalImage method)
- computePrudentBetaLevel(self, Debug=False)
- computes alpha, ie the lowest valuation level, for which the
bipolarly polarised digraph doesn't contain a chordless circuit.
- computeRankingByBestChoosing(self, CoDual=False, Debug=False)
- Computes a weak preordering of the self.actions by recursive
best choice elagations.
Stores in self.rankingByBestChoosing['result'] a list of (P+,bestChoice) tuples
where P+ gives the best choice complement outranking
average valuation via the computePairwiseClusterComparison
method.
If self.rankingByBestChoosing['CoDual'] is True,
the ranking-by-choosing was computed on the codual of self.
- computeRankingByBestChoosingRelation(self, rankingByBestChoosing=None, Debug=False)
- Renders the bipolar-valued relation obtained from
the self.rankingByBestChoosing result.
- computeRankingByChoosing(self, actionsSubset=None, Debug=False, CoDual=False)
- Computes a weak preordring of the self.actions by iterating
jointly first and last choice elagations.
Stores in self.rankingByChoosing['result'] a list of ((P+,bestChoice),(P-,worstChoice)) pairs
where P+ (resp. P-) gives the best (resp. worst) choice complement outranking
(resp. outranked) average valuation via the computePairwiseClusterComparison
method.
If self.rankingByChoosing['CoDual'] is True, the ranking-by-choosing was computed on the codual of self.
- computeRankingByChoosingRelation(self, rankingByChoosing=None, actionsSubset=None, Debug=False)
- Renders the bipolar-valued relation obtained from
the self.rankingByChoosing result.
- computeRankingByLastChoosing(self, CoDual=False, Debug=False)
- Computes a weak preordring of the self.actions by iterating
worst choice elagations.
Stores in self.rankingByLastChoosing['result'] a list of (P-,worstChoice) pairs
where P- gives the worst choice complement outranked
average valuation via the computePairwiseClusterComparison
method.
If self.rankingByChoosing['CoDual'] is True, the ranking-by-last-chossing
was computed on the codual of self.
- computeRankingByLastChoosingRelation(self, rankingByLastChoosing=None, Debug=False)
- Renders the bipolar-valued relation obtained from
the self.rankingByLastChoosing result.
- computeRankingCorrelation(self, ranking, Debug=False)
- Renders the ordinal correlation K of a digraph instance
when compared with a given linear ranking of its actions
K = sum_{x != y} [ min( max(-self.relation(x,y)),other.relation(x,y), max(self.relation(x,y),-other.relation(x,y)) ]
K /= sum_{x!=y} [ min(abs(self.relation(x,y),abs(other.relation(x,y)) ]
.. note::
Renders a tuple with at position 0 the actual bipolar correlation index
and in position 1 the minimal determination level D of self and
the other relation.
D = sum_{x != y} min(abs(self.relation(x,y)),abs(other.relation(x,y)) / n(n-1)
where n is the number of actions considered.
The correlation index with a completely indeterminate relation
is by convention 0.0 at determination level 0.0 .
- computeRelationalStructure(self, Debug=False)
- Renders the counted decomposition of the valued relations into
the following type of links:
gt '>', eq '=', lt '<', incomp '<>',
leq '<=', geq '>=', indeterm '?'
- computeRubisChoice(self, Comments=False, _OldCoca=False, BrokenCocs=True, Threading=False, nbrOfCPUs=1)
- Renders self.strictGoodChoices, self.nullChoices
self.strictBadChoices, self.nonRobustChoices.
.. warning::
Changes in site the outranking digraph by
adding or braking chordless odd outranking circuits.
- computeRubyChoice(self, Comments=False, _OldCoca=False)
- dummy for computeRubisChoice()
old versions compatibility.
- computeShortestPathLengths(self, WeakPaths=False, Comments=False, Debug=False)
- Renders a double dictionary with the directed distances, i.e. the shortest path lengths between all self.actions.
Equals *None* if there does not exist a directed path between two actions.
*Source*: Claude Berge, *The Theory of Graphs*, Dover (2001) pp. 119, original in French Dunod (1958)
- computeSize(self)
- Renders the number of validated non reflexive arcs
- computeSizeTransitiveClosure(self)
- Renders the size of the transitive closure of a digraph.
- computeSlaterOrder(self, isProbabilistic=False, seed=None, sampleSize=1000, Debug=False)
- Reversed return from computeSlaterRanking method.
- computeSlaterRanking(self, isProbabilistic=False, seed=None, sampleSize=1000, Debug=False)
- Renders a ranking of the actions with minimal Slater index.
Return a tuple: slaterOrder, slaterIndex
- computeSymmetryDegree(self, InPercents=False, Comments=False)
- Renders the symmetry degree (Decimal) of the irreflexive part of a digraph.
.. note::
Empty and indeterminate digraphs are considered to be symmetric.
- computeTopologicalRanking(self, Debug=False)
- Mimetic Wrapper of the topologicalSort() method.
- computeTransitivityDegree(self, InPercents=False, Comments=False)
- Renders the transitivity degree (Decimal) of a digraph.
.. note::
An empty or indeterminate digraph is considered to be transitive.
- computeUnrelatedPairs(self)
- Renders a list of more or less unrelated pairs.
- computeValuationLevels(self, choice=None, Debug=False)
- renders the symmetric closure of the
apparent valuations levels of self
in an increasingly ordered list.
If parameter choice is given, the
computation is limited to the actions
of the choice.
- computeValuationPercentages(self, choice, percentiles, withValues=False)
- Parameters: choice and list of percentiles.
renders a series of percentages of the characteristics valuation of
the arcs in the digraph.
- computeValuationPercentiles(self, choice, percentages, withValues=False)
- Parameters: choice and list of percentages.
renders a series of quantiles of the characteristics valuation of
the arcs in the digraph.
- computeValuationStatistics(self, Sampling=False, Comments=False)
- Renders the mean and variance of the valuation
of the non reflexive pairs.
- computeValuedRankingRelation(self, ranking)
- Renders the valued relation characteristics compatible
with the given linar ranking. Discordant charcateristics
are set to the indeterminate value.
- computeWeakCondorcetLosers(self)
- Wrapper for weakCondorcetLosers().
- computeWeakCondorcetWinners(self)
- Wrapper for weakCondorcetWinners().
- computeupdown1(self, s, S)
- Help method for show_MIS_HB2 method.
fills self.newmisset, self.upmis, self.downmis.
- computeupdown2(self, s, S)
- Help method for show_MIS_HB1 method.
Fills self.newmisset, self.upmis, self.downmis.
- computeupdown2irred(self, s, S)
- Help method for show_MIS_HB1 method.
Fills self.newmisset, self.upmis, self.downmis.
- condorcetLosers(self)
- Renders the set of decision actions x such that
self.relation[x][y] < self.valuationdomain['med']
for all y != x.
- condorcetWinners(self)
- Renders the set of decision actions x such that
self.relation[x][y] > self.valuationdomain['med']
for all y != x.
- contra(self, v)
- Parameter: choice.
Renders the negation of a choice v characteristic's vector.
- convertRelationToDecimal(self)
- Converts the float valued self.relation in a decimal valued one.
- convertValuation2Integer(self, InSite=True, Comments=False)
- Converts the self.relation valuation to integer values by converting the Decimals to Fractions and multiply by the least commun multiple of the fraction denominators.
*Parameters*:
- If *Insite* == False (True by default) the method returns a modified copy of self.relation without altering the original self.relation, otherwise self.relation and self.valuationdomain is modified.
- convertValuationToDecimal(self)
- Convert the float valuation limits to Decimals.
- coveringIndex(self, choice, direction='out')
- Renders the covering index of a given choice in a set of objects,
ie the minimum number of choice members that cover each
non selected object.
- crispKDistance(self, digraph, Debug=False)
- Renders the crisp Kendall distance between two bipolar valued
digraphs.
.. warning::
Obsolete! Is replaced by the self.computeBipolarCorrelation(other, MedianCut=True) Digraph method
- detectChordlessCircuits(self, Comments=False, Debug=False)
- Detects a chordless circuit in a digraph.
Returns a Boolean
- detectChordlessPath(self, Pk, n2, Comments=False, Debug=False)
- New procedure from Agrum study April 2009
recursive chordless path extraction starting from path
Pk = [n2, ...., n1] and ending in node n2.
Optimized with marking of visited chordless P1s.
- determinateness(self, vec, inPercent=True)
- Renders the determinateness of a characteristic vector *vec* =
[(r(x),x),(r(y),y), ...] of length *n* in valuationdomain [Min,Med,Max]:
*result* = sum_x( abs(r(x)-Med) ) / ( n*(Max-Med) )
If inPercent, *result* shifted (+1) and reduced (/2) to [0,1] range.
- digraph2Graph(self, valuationDomain={'min': -1, 'med': 0, 'max': 1}, Debug=False, ConjunctiveConversion=True)
- Convert a Digraph instance to a Graph instance.
- dneighbors(self, node)
- Renders the set of dominated out-neighbors of a node.
- domin(self, choice)
- Renders the dominance degree of a choice.
- dominantChoices(self, S)
- Generates all minimal dominant choices of a bipolar valued digraph.
.. note::
Initiate with S = self.actions.copy().
- domirred(self, choice)
- Renders the crips +irredundance degree of a choice.
- domirredval(self, choice, relation)
- Renders the valued +irredundance degree of a choice.
- domirredx(self, choice, x)
- Renders the crips +irredundance degree of node x in a choice.
- domkernelrestrict(self, prekernel)
- Parameter: dominant prekernel
Renders dominant prekernel restricted relation.
- exportPrincipalImage(self, plotFileName=None, pictureFormat='pdf', bgcolor='cornsilk', fontcolor='red3', fontsize='0.75', Reduced=False, Colwise=False, tempDir='.', Comments=False)
- Export as PDF (default) the principal projection of
the valued relation using the three principal eigen vectors.
Implemeted picture formats are:
'pdf' (default), 'png', 'jpeg' and 'xfig'.
The background color is set by default to 'cornsilk'.
Font size and color are set by default to 'red3', resp. '0.75'.
When *Reduced==True*, the valued relation characeteristics are centered and reduced.
When *Colwise==True*, the column vectors of the adjacency table are used for the principal projection, otherwise the rows (default) are used. Has no incidence when the *Digraph* instance *self* is symmetric.
.. warning::
The method, writing and reading temporary files:
tempCol.r and rotationCol.csv, resp. tempRow.r and rotationRow.csv,
by default in the working directory (./),
is hence not safe for multiprocessing programs, unless a
temporary directory *tempDir* is provided.
- flatChoice(self, ch, Debug=False)
- Converts set or list ch recursively to a flat list of items.
- forcedBestSingleChoice(self)
- Renders the set of most determined outranking singletons in self.
- gammaSets(self)
- Renders the dictionary of neighborhoods {node: (dx,ax)}
with set *dx* gathering the dominated, and set *ax* gathering
the absorbed neighborhood.
- generateAbsPreKernels(self)
- Generate all absorbent prekernels from independent choices generator.
- generateDomPreKernels(self)
- Generate all dominant prekernels from independent choices generator.
- htmlChoiceVector(self, ch, ChoiceVector=True, choiceType='good')
- Show procedure for annotated bipolar choices.
- inDegrees(self)
- renders the median cut indegrees
- inDegreesDistribution(self)
- Renders the distribution of indegrees.
- independentChoices(self, U)
- Generator for all independent choices with neighborhoods of a bipolar valued digraph:
.. note::
* Initiate with U = self.singletons().
* Yields [(independent choice, domnb, absnb, indnb)].
- inner_prod(self, v1, v2)
- Parameters: two choice characteristic vectors
Renders the inner product of two characteristic vetors.
- intstab(self, choice)
- Computes the independence degree of a choice.
- irreflex(self, mat)
- Puts diagonal entries of mat to valuationdomain['min']
- isAsymmetricIndeterminate(self, Debug=False)
- Checks the self.relation for assymmetric indeterminateness!!
.. warning::
The reflexive links are ignored !!
- isComplete(self, Debug=False)
- checks the completeness property of self.relation by checking
for the absence of a link between two actions!!
.. warning::
The reflexive links are ignored !!
- isCyclic(self, Debug=False)
- checks the cyclicity of self.relation by checking
for a reflexive loop in its transitive closure-
.. warning::
self.relation is supposed to be irreflexive !
- isIntegerValued(self, Debug=False)
- Checks whether the decimal valuation of self is integer-valued
be using the as_integer_ratio() method of a Decimal
giving a tuple (numerator,denominator). If denominator == 1, the
number is an integer.
- isOutrankingDigraph(self, Comments=True, Debug=False)
- Checks the outranking digraph characteristic condition (3.3).
relation[x][y] + relation[y][x)[y] >= 0.0
.. warning::
The reflexive links are ignored and the valuation must be bipolar !!
- isStrictOutrankingDigraph(self, Comments=True, Debug=False)
- Checks the strict outranking digraph characteristic condition (3.1).
-(relation[x][y] + relation[y][x]) <= 0.0 , x != y
.. warning::
The reflexive links are ignored and the valuation must be bipolar !!
- isSymmetric(self, Comments=False)
- True if symmetry degree == 1.0.
- isTransitive(self, Comments=False)
- True if transitivity degree == 1.0.
- isWeaklyComplete(self, Debug=False)
- checks the weakly completeness property of self.relation by checking
for the absence of a link between two actions!!
.. warning::
The reflexive links are ignored !!
- iterateRankingByChoosing(self, Odd=False, CoDual=False, Comments=True, Debug=False, Limited=None)
- Renders a ranking by choosing result when progressively eliminating
all chordless (odd only) circuits with rising valuation cut levels.
Parameters
CoDual = False (default)/True
Limited = proportion (in [0,1]) * (max - med) valuationdomain
- kChoices(self, A, k)
- Renders all choices of length k from set A
- matmult2(self, m, v)
- Parameters: digraph relation and choice characteristic vector
matrix multiply vector by inner production
- meanDegree(self)
- Renders the mean degree of self.
!!! self.size must be set previously !!!
- meanLength(self, Oriented=False)
- Renders the (by default non-oriented) mean neighbourhoor depth of self.
!!! self.order must be set previously !!!
- minimalChoices(self, S)
- Generates all dominant or absorbent choices of a bipolar
valued digraph.
.. note:
* Initiate with S = (actions, dict of dominant or absorbent closed neighborhoods)
* See showMinDom and showMinAbs methods.
- minimalValuationLevelForCircuitsElimination(self, Odd=True, Debug=False, Comments=False)
- renders the minimal valuation level <lambda> that eliminates all
self.circuitsList stored odd chordless circuits from self.
.. warning::
The <lambda> level polarised may still contain newly appearing chordless odd circuits !
- neighbourhoodCollection(self, Oriented=False, Potential=False)
- Renders the neighbourhood.
- neighbourhoodDepthDistribution(self, Oriented=False)
- Renders the distribtion of neighbourhood depths.
- notGammaSets(self)
- Renders the dictionary of neighborhoods {node: (dx,ax)}
with set *dx* gathering the not dominated, and set *ax* gathering
the not absorbed neighborhood.
- notaneighbors(self, node)
- Renders the set of absorbed not in-neighbors of a node.
- notdneighbors(self, node)
- Renders the set of not dominated out-neighbors of a node.
- outDegrees(self)
- renders the median cut outdegrees
- outDegreesDistribution(self)
- Renders the distribution of outdegrees.
- plusirredundant(self, U)
- Generates all +irredundant choices of a digraph.
- powerset(self, U)
- Generates all subsets of a set.
- readPerrinMisset(self, file='curd.dat')
- read method for 0-1-char-coded MISs by default from the perrinMIS.c curd.dat result file.
- readabsvector(self, x, relation)
- Parameter: action x
absorbent in vector.
- readdomvector(self, x, relation)
- Parameter: action x
dominant out vector.
- relationFct(self, x, y)
- wrapper for self.relation dictionary access to ensure interoperability
with the sparse and big outranking digraph implementation model.
- save(self, fileName='tempdigraph', option=None, DecimalValuation=True, decDigits=2)
- Persistent storage of a Digraph class instance in the form of
a python source code file
- saveCSV(self, fileName='tempdigraph', Normalized=False, Dual=False, Converse=False, Diagonal=False, Debug=False)
- Persistent storage of a Digraph class instance in the form of
a csv file.
- saveXMCDA2(self, fileName='temp', fileExt='xmcda2', Comments=True, relationName='R', relationType='binary', category='random', subcategory='valued', author='digraphs Module (RB)', reference='saved from Python', valuationType='standard', digits=2, servingD3=False)
- save digraph in XMCDA 2.0 format. Deprecated now.
- savedre(self, fileName='temp')
- save digraph in nauty format.
- sharp(self, x, y)
- Paramaters: choice characteristic values.
Renders the sharpest of two characteristic values x and y.
- sharpvec(self, v, w)
- Paramaters: choice characteristic vectors.
Renders the sharpest of two characteristic vectors v and w.
- showAttributes(self)
- Prints out the attributes of self.
- showAutomorphismGenerators(self)
- Renders the generators of the automorphism group.
- showBadChoices(self, Recompute=True)
- Characteristic values for potentially bad choices.
- showChoiceVector(self, ch, choiceType='good', ChoiceVector=True)
- Show procedure for annotated bipolar choices.
- showChordlessCircuits(self, Recompute=False)
- Show method for chordless circuits observed in a Digraph instance.
If previous computation is required, stores the detected circuits in self.circuitsList attribute.
- showCorrelation(self, corr=None, ndigits=3)
- Renders the valued ordinal correlation index, the crisp Kendall tau index and their epistemic determination degree.
- showFirstChoiceRecommendation(self, Verbose=False, Comments=True, ChoiceVector=False, CoDual=True, Debug=False, _OldCoca=False, BrokenCocs=True)
- Shows the RuBis first choice recommendation.
.. note::
Computes by default the Rubis first choice recommendation on the corresponding strict (codual) outranking digraph.
By default, with BrokenCocs=True, we brake all chordless circuits at their weakest determined ( abs(r(x>y)) + abs(r(y>x)) ) link.
When BrokenCocs=False we proceed like follows:
In case of chordless circuits, if supporting arcs are more credible
than the reversed negating arcs, we collapse the circuits into hyper nodes.
Inversely, if supporting arcs are not more credible than the reversed negating arcs,
we brake the circuits on their weakest arc.
Usage example:
>>> from outrankingDigraphs import *
>>> t = Random3ObjectivesPerformanceTableau(seed=5)
>>> g = BipolarOutrankingDigraph(t)
>>> g.showFirstChoiceRecommendation()
***********************
RuBis First Choice Recommendation (BCR)
(in decreasing order of determinateness)
Credibility domain: [-100.0, 100.0]
=== >> potential first choices
* choice : ['a04', 'a14', 'a19', 'a20']
independence : 1.19
dominance : 4.76
absorbency : -59.52
covering (%) : 75.00
determinateness (%) : 57.86
- most credible action(s) = { 'a14': 23.81, 'a19': 11.90, 'a04': 2.38, 'a20': 1.19, }
=== >> potential last choices
* choice : ['a03', 'a12', 'a17']
independence : 4.76
dominance : -76.19
absorbency : 4.76
covering (%) : 0.00
determinateness (%) : 65.39
- most credible action(s) = { 'a03': 38.10, 'a12': 13.10, 'a17': 4.76, }
Execution time: 0.024 seconds
*****************************
- showGoodChoices(self, Recompute=True)
- Characteristic values for potentially good choices.
- showHTMLBestChoiceRecommendation(self, pageTitle=None, ChoiceVector=False, CoDual=True, Debug=False, _OldCoca=False, BrokenCocs=True, htmlFileName=None)
- showHTMLRelationHeatmap(self, actionsList=None, rankingRule='NetFlows', colorLevels=7, tableTitle='Relation Heatmap', relationName='r(x S y)', ndigits=2, fromIndex=None, toIndex=None, htmlFileName=None)
- Launches a browser window with the colored relation map of self.
See corresponding :py:class:`~digraphs.Digraph.showHTMLRelationMap` method.
The *colorLevels* parameter may be set to 3, 5, 7 (default) or 9.
When the *actionsList* parameter is *None* (default), the digraphs actions list may be ranked with the *rankingRule* parameter set to the 'Copeland' (default) or to the 'Netlows' ranking rule.
When the *htmlFileName* parameter is set to a string value 'xxx', a html file named 'xxx.html' will be generated in the current working directory. Otherwise, a temporary file named 'tmp*.html' will be generated there.
Example::
>>> from outrankingDigraphs import *
>>> t = RandomCBPerformanceTableau(numberOfActions=25,seed=1)
>>> g = BipolarOutrankingDigraph(t,ndigits=2)
>>> gcd = ~(-g) # strict outranking relation
>>> gcd.showHTMLRelationHeatmap(colorLevels=7,ndigits=2)
.. image:: relationHeatmap.png
:alt: Browser view of a relation map
:width: 600 px
:align: center
- showMIS(self, withListing=True)
- Prints all maximal independent choices:
Result in self.misset.
- showMIS_AH(self, withListing=True)
- Prints all MIS using the Hertz method.
Result saved in self.hertzmisset.
- showMIS_HB2(self, withListing=True)
- Prints all MIS using the Hertz-Bisdorff method.
Result saved in self.newmisset.
- showMIS_RB(self, withListing=True)
- Prints all MIS using the Bisdorff method.
Result saved in self.newmisset.
- showMIS_UD(self, withListing=True)
- Prints all MIS using the Hertz-Bisdorff method.
Result saved in self.newmisset.
- showMaxAbsIrred(self, withListing=True)
- Computing maximal -irredundant choices:
Result in self.absirset.
- showMaxDomIrred(self, withListing=True)
- Computing maximal +irredundant choices:
Result in self.domirset.
- showMinAbs(self, withListing=True)
- Prints minimal absorbent choices:
Result in self.absset.
- showMinDom(self, withListing=True)
- Prints all minimal dominant choices:
Result in self.domset.
- showNeighborhoods(self)
- Lists the gamma and the notGamma function of self.
- showOrbits(self, InChoices, withListing=True)
- Prints the orbits of Choices along the automorphisms of
the Digraph instance.
Example Python session for computing the non isomorphic MISs from the 12-cycle graph:
>>> from digraphs import *
>>> c12 = CirculantDigraph(order=12,circulants=[1,-1])
>>> c12.automorphismGenerators()
...
Permutations
{'1': '1', '2': '12', '3': '11', '4': '10', '5':
'9', '6': '8', '7': '7', '8': '6', '9': '5', '10':
'4', '11': '3', '12': '2'}
{'1': '2', '2': '1', '3': '12', '4': '11', '5': '10',
'6': '9', '7': '8', '8': '7', '9': '6', '10': '5',
'11': '4', '12': '3'}
Reflections {}
>>> print('grpsize = ', c12.automorphismGroupSize)
grpsize = 24
>>> c12.showMIS(withListing=False)
*--- Maximal independent choices ---*
number of solutions: 29
cardinality distribution
card.: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
freq.: [0, 0, 0, 0, 3, 24, 2, 0, 0, 0, 0, 0, 0]
Results in c12.misset
>>> c12.showOrbits(c12.misset,withListing=False)
...
*---- Global result ----
Number of MIS: 29
Number of orbits : 4
Labelled representatives:
1: ['2','4','6','8','10','12']
2: ['2','5','8','11']
3: ['2','4','6','9','11']
4: ['1','4','7','9','11']
Symmetry vector
stabilizer size: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ...]
frequency : [0, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, ...]
*Figure*: The symmetry axes of the non isomorphic MISs of the 12-cycle:
.. image:: c12.png
:width: 400 px
:align: center
:alt: The 4 non isomorphic MIS of the 12-cycle graph
*Reference*: R. Bisdorff and J.L. Marichal (2008). Counting non-isomorphic maximal independent sets of the n-cycle graph. *Journal of Integer Sequences*, Vol. 11 Article 08.5.7 (`openly accessible here <https://www.cs.uwaterloo.ca/journals/JIS/VOL11/Marichal/marichal.html>`_)
- showOrbitsFromFile(self, InFile, withListing=True)
- Prints the orbits of Choices along the automorphisms of
the digraph self by reading in the 0-1 misset file format.
See the :py:func:`digraphs.Digraph.readPerrinMisset` method.
- showPreKernels(self, withListing=True)
- Printing dominant and absorbent preKernels:
Result in self.dompreKernels and self.abspreKernels
- showRankingByBestChoosing(self, rankingByBestChoosing=None)
- A show method for self.rankinByBestChoosing result.
.. warning::
The self.computeRankingByBestChoosing(CoDual=False/True) method instantiating the self.rankingByBestChoosing slot is pre-required !
- showRankingByChoosing(self, rankingByChoosing=None, WithCoverCredibility=False)
- A show method for self.rankinByChoosing result.
When parameter *WithCoverCredibility* is set to True, the credibility of outranking, respectively being outranked is indicated at each selection step.
.. warning::
The self.computeRankingByChoosing(CoDual=False/True) method instantiating the self.rankingByChoosing slot is pre-required !
- showRankingByLastChoosing(self, rankingByLastChoosing=None, Debug=None)
- A show method for self.rankinByChoosing result.
.. warning::
The self.computeRankingByLastChoosing(CoDual=False/True) method instantiating the self.rankingByChoosing slot is pre-required !
- showRelation(self)
- prints the relation valuation in ##.## format.
- showRubyChoice(self, Verbose=False, Comments=True, _OldCoca=True)
- Dummy for showBestChoiceRecommendation()
needed for older versions compatibility.
- showStatistics(self)
- Computes digraph statistics like order, size and arc-density.
- showdre(self)
- Shows relation in nauty format.
- singletons(self)
- list of singletons and neighborhoods
[(singx1, +nx1, -nx1, not(+nx1 or -nx1)),.... ]
- sizeSubGraph(self, choice)
- Output: (size, undeterm,arcDensity).
Renders the arc density of the induced subgraph.
- strongComponents(self, setPotential=False)
- Renders the set of strong components of self.
- symDegreesDistribution(self)
- Renders the distribution of symmetric degrees.
- topologicalSort(self, Debug=False)
- If self is acyclic, adds topological sort number to each node of self
and renders ordered list of nodes. Otherwise renders None.
Source: M. Golumbic Algorithmic Graph heory and Perfect Graphs,
Annals Of Discrete Mathematics 57 2nd Ed. , Elsevier 2004, Algorithm 2.4 p.44.
- weakAneighbors(self, node)
- Renders the set of absorbed in-neighbors of a node.
- weakCondorcetLosers(self)
- Renders the set of decision actions x such that
self.relation[x][y] <= self.valuationdomain['med']
for all y != x.
- weakCondorcetWinners(self)
- Renders the set of decision actions x such that
self.relation[x][y] >= self.valuationdomain['med']
for all y != x.
- weakDneighbors(self, node)
- Renders the set of dominated out-neighbors of a node.
- weakGammaSets(self)
- Renders the dictionary of neighborhoods {node: (dx,ax)}
- zoomValuation(self, zoomFactor=1.0)
- Zooms in or out, depending on the value of the zoomFactor provided,
the bipolar valuation of a digraph.
Data descriptors inherited from digraphs.Digraph:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Methods inherited from perfTabs.PerformanceTableau:
- computeActionCriterionPerformanceDifferences(self, refAction, refCriterion, comments=False, Debug=False)
- computes the performances differences observed between the reference action and the others on the given criterion
- computeActionCriterionQuantile(self, action, criterion, strategy='average', Debug=False)
- renders the quantile of the performance of action on criterion
- computeActionQuantile(self, action, Debug=False)
- renders the overall performance quantile of action
- computeAllQuantiles(self, Sorted=True, Comments=False)
- renders a html string showing the table of
the quantiles matrix action x criterion
- computeCriterionPerformanceDifferences(self, c, Comments=False, Debug=False)
- Renders the ordered list of all observed performance differences on the given criterion.
- computeDefaultDiscriminationThresholds(self, criteriaList=None, quantile={'ind': 10, 'pref': 20, 'weakVeto': 60, 'veto': 80}, Debug=False, Comments=False)
- updates the discrimination thresholds with the percentiles
from the performance differences.
Parameters: quantile = {'ind': 10, 'pref': 20, 'weakVeto': 60, 'veto: 80}.
- computeMinMaxEvaluations(self, criteria=None, actions=None)
- renders minimum and maximum performances on each criterion
in dictionary form: {'g': {'minimum': x, 'maximum': x}}
- computeMissingDataProportion(self, InPercents=False, Comments=False)
- Renders the proportion of missing data,
i.e. NA == Decimal('-999') entries in self.evaluation.
- computeNormalizedDiffEvaluations(self, lowValue=0.0, highValue=100.0, withOutput=False, Debug=False)
- renders and csv stores (withOutput=True) the
list of normalized evaluation differences observed on the family of criteria
Is only adequate if all criteria have the same
evaluation scale. Therefore the performance tableau is normalized to 0.0-100.0 scales.
- computePerformanceDifferences(self, Comments=False, Debug=False, NotPermanentDiffs=True, WithMaxMin=False)
- Adds to the criteria dictionary the ordered list of all observed performance differences.
- computeQuantileOrder(self, q0=3, q1=0, Threading=False, nbrOfCPUs=None, startMethod=None, Comments=False)
- Renders a linear ordering of the decision actions from a simulation of pre-ranked outranking digraphs.
The pre-ranking simulations range by default from
quantiles=q0 to quantiles=min( 100, max(10,len(self.actions)/10]) ).
The actions are ordered along a decreasing Borda score of their ranking results.
- computeQuantilePreorder(self, Comments=True, Debug=False)
- computes the preorder of the actions obtained from decreasing majority quantiles. The quantiles are recomputed with a call to the self.computeQuantileSort() method.
- computeQuantileRanking(self, q0=3, q1=0, Threading=False, nbrOfCPUs=None, startMethod=None, Comments=False)
- Renders a linear ranking of the decision actions from a simulation of pre-ranked outranking digraphs.
The pre-ranking simulations range by default from
quantiles=q0 to qantiles=min( 100, max(10,len(self.actions)/10) ).
The actions are ordered along an increasing Borda score of their ranking results.
- computeQuantileSort(self)
- shows a sorting of the actions from decreasing majority quantiles
- computeQuantiles(self, Debug=False)
- renders a quantiles matrix action x criterion with the performance quantile of action on criterion
- computeRankingConsensusQuality(self, ranking, Comments=False, Threading=False, nbrOfCPUs=1)
- Renders the marginal criteria correlations with a given ranking with summary.
- computeThresholdPercentile(self, criterion, threshold, Debug=False)
- computes for a given criterion the quantile
of the performance differences of a given constant threshold.
- computeVariableThresholdPercentile(self, criterion, threshold, Debug=False)
- computes for a given criterion the quantile
of the performance differences of a given threshold.
- computeWeightPreorder(self)
- renders the weight preorder following from the given
criteria weights in a list of increasing equivalence
lists of criteria.
- computeWeightedAveragePerformances(self, isNormalized=False, lowValue=0.0, highValue=100.0, isListRanked=False)
- Compute normalized weighted average scores by ignoring missing data.
When *isNormalized* == True (False by default),
transforms all the scores into a common 0-100 scale.
A lowValue and highValue parameter
can be provided for a specific normalisation.
- convert2BigData(self)
- Renders a cPerformanceTableau instance, by converting the action keys to integers and evaluations to floats, including the discrimination thresholds, the case given.
- convertDiscriminationThresholds2Decimal(self)
- convertDiscriminationThresholds2Float(self)
- convertEvaluation2Decimal(self)
- Convert evaluations from obsolete float format to decimal format
- convertEvaluation2Float(self)
- Convert evaluations from decimal format to float
- convertInsite2BigData(self)
- Convert in site a standard formated Performance tableau into a bigData formated instance.
- convertInsite2Standard(self)
- Convert in site a bigData formated Performance tableau back into a standard formated PerformanceTableau instance.
- convertWeight2Decimal(self)
- Convert significance weights from obsolete float format
to decimal format.
- convertWeight2Integer(self)
- Convert significance weights from Decimal format
to int format.
- convertWeights2Negative(self)
- Negates the weights of criteria to be minimzed.
- convertWeights2Positive(self)
- Sets negative weights back to positive weights and negates corresponding evaluation grades.
- csvAllQuantiles(self, fileName='quantiles')
- save quantiles matrix criterionxaction in CSV format
- hasOddWeightAlgebra(self, Debug=False)
- Verify if the given criteria[self]['weight'] are odd or not.
Return a Boolen value.
- normalizeEvaluations(self, lowValue=0.0, highValue=100.0, Debug=False)
- recode the evaluations between lowValue and highValue on all criteria
- quantizeCriterionEvaluations(self, g, q, ndigits=2, Debug=True)
- q-tile evaluation of criterion q
- replaceNA(self, newNA=None, Comments=False)
- Replaces the current self.NA symbol with the *newNA* symbol of type <Decimal>. If newNA is None, the defauklt value Decimal('-999') is used.
- restoreOriginalEvaluations(self, lowValue=0.0, highValue=100.0, Debug=False)
- recode the evaluations to their original values on all criteria
- saveXMCDA2String(self, fileName='temp', category='XMCDA 2.0 format', user='digraphs Module (RB)', version='saved from Python session', title='Performance Tableau in XMCDA-2.0 format.', variant='Rubis', valuationType='bipolar', servingD3=True, comment='produced by stringIO()', stringNA='NA')
- save performance tableau object self in XMCDA 2.0 format.
!!! obsolete: replaced by the isStringIO in the saveXMCDA2 method !!!
- setObjectiveWeights(self, Debug=False)
- Set the objective weights to the sum of the corresponding criteria significance weights.
- showAllQuantiles(self, Sorted=True)
- prints the performance quantiles tableau in the session console.
- showEvaluationStatistics(self)
- renders the variance and standard deviation of
the values observed in the performance Tableau.
- showHTMLCriteria(self, criteriaSubset=None, Sorted=True, ndigits=2, title=None, htmlFileName=None)
- shows the criteria in the system browser view.
- showHTMLPerformanceHeatmap(self, actionsList=None, WithActionNames=False, fromIndex=None, toIndex=None, Transposed=False, criteriaList=None, colorLevels=7, pageTitle=None, ndigits=2, SparseModel=False, outrankingModel='standard', minimalComponentSize=1, rankingRule='NetFlows', StoreRanking=True, quantiles=None, strategy='average', Correlations=False, htmlFileName=None, Threading=False, startMethod=None, nbrOfCPUs=None, Debug=False)
- shows the html heatmap version of the performance tableau in a browser window
(see perfTabs.htmlPerformanceHeatMap() method ).
**Parameters**:
* *actionsList* and *criteriaList*, if provided, give the possibility to show
the decision alternatives, resp. criteria, in a given ordering.
* *WithActionNames* = True (default False) will show the action names instead of the short names or the identifyers.
* *ndigits* = 0 may be used to show integer evaluation values.
* *colorLevels* may be 3, 5, 7, or 9.
* When no *actionsList* is provided, the decision actions are ordered from the best to the worst. This
ranking is obtained by default with the Copeland rule applied on a standard *BipolarOutrankingDigraph*.
* When the *SparseModel* flag is put to *True*, a sparse *PreRankedOutrankingDigraph* construction is used instead.
* the *outrankingModel* parameter (default = 'standard') allows to switch to alternative BipolarOutrankingDigraph constructors, like 'confident' or 'robust' models. When called from a bipolar-valued outrankingDigraph instance, *outrankingModel* = 'this' keeps the current outranking model without recomputing by default the standard outranking model.
* The *minimalComponentSize* allows to control the fill rate of the pre-ranked model.
When *minimalComponentSize* = *n* (the number of decision actions) both the pre-ranked model will be
in fact equivalent to the standard model.
* *rankingRule* = 'NetFlows' (default) | 'Copeland' | 'Kohler' | 'RankedPairs' | 'ArrowRaymond'
| 'IteratedNetFlows' | 'IteraredCopeland'. See tutorial on ranking mith multiple incommensurable criteria.
* when the *StoreRanking* flag is set to *True*, the ranking result is storted in *self*.
* Quantiles used for the pre-ranked decomposition are put by default to *n*
(the number of decision alternatives) for *n* < 50. For larger cardinalities up to 1000, quantiles = *n* /10.
For bigger performance tableaux the *quantiles* parameter may be set to a much lower value
not exceeding usually 10.
* The pre-ranking may be obtained with three ordering strategies for the
quantiles equivalence classes: 'average' (default), 'optimistic' or 'pessimistic'.
* With *Correlations* = *True* and *criteriaList* = *None*, the criteria will be presented from left to right in decreasing
order of the correlations between the marginal criterion based ranking and the global ranking used for
presenting the decision alternatives.
* For large performance Tableaux, *multiprocessing* techniques may be used by setting
*Threading* = *True* in order to speed up the computations; especially when *Correlations* = *True*.
* By default, the number of cores available, will be detected. It may be necessary in a HPC context to indicate the exact number of singled threaded cores in fact allocated to the multiprocessing job.
>>> from randomPerfTabs import RandomPerformanceTableau
>>> rt = RandomPerformanceTableau(seed=100)
>>> rt.showHTMLPerformanceHeatmap(colorLevels=5,Correlations=True)
.. image:: perfTabsExample.png
:alt: HTML heat map of the performance tableau
:width: 600 px
:align: center
- showHTMLPerformanceQuantiles(self, Sorted=True, htmlFileName=None)
- shows the performance quantiles tableau in a browser window.
- showHTMLPerformanceTableau(self, actionsSubset=None, fromIndex=None, toIndex=None, isSorted=False, Transposed=False, ndigits=2, ContentCentered=True, title=None, htmlFileName=None)
- shows the html version of the performance tableau in a browser window.
- showObjectives(self)
- showQuantileSort(self, Debug=False)
- Wrapper of computeQuantilePreorder() for the obsolete showQuantileSort() method.
- showRankingConsensusQuality(self, ranking)
- shows the marginal criteria correlations with a given ranking with summary.
- showWeightPreorder(self)
- Renders a preordering of the the criteria signficance weights.
|
class PreRankedOutrankingDigraph(SparseOutrankingDigraph, perfTabs.PerformanceTableau) |
| |
PreRankedOutrankingDigraph(argPerfTab, quantiles=None, quantilesOrderingStrategy='average', LowerClosed=False, componentRankingRule='Copeland', minimalComponentSize=1, Threading=False, startMethod=None, tempDir=None, nbrOfCPUs=None, nbrOfThreads=0, save2File=None, CopyPerfTab=True, Comments=False, Debug=False)
Main class for the multiprocessing implementation of sparse outranking digraphs.
The associated performance tableau instance is decomposed with a q-tiling sort into a partition of quantile equivalence classes which are linearly ordered by average quantile limits (default).
With each quantile equivalence class is associated a BipolarOutrankingDigraph object which is restricted to the decision actions gathered in this quantile equivalence class.
See https://rbisdorff.github.io/documents/DA2PL-RB-2016.pdf
By default, the number of quantiles is set to 5 when the numer of actions is less than 100, to 10 when the number of actions is less than 1000, or otherwise to 0.5% of the numer of decision actions. The number of quantiles can be set much lower for bigger orders. Mind the effective availability of CPU memory when tackling big digraph orders.
For other parameters settings, see the corresponding :py:class:`sortingDigraphs.QuantilesSortingDigraph` class. |
| |
- Method resolution order:
- PreRankedOutrankingDigraph
- SparseOutrankingDigraph
- outrankingDigraphs.BipolarOutrankingDigraph
- outrankingDigraphs.OutrankingDigraph
- digraphs.Digraph
- perfTabs.PerformanceTableau
- builtins.object
Methods defined here:
- __init__(self, argPerfTab, quantiles=None, quantilesOrderingStrategy='average', LowerClosed=False, componentRankingRule='Copeland', minimalComponentSize=1, Threading=False, startMethod=None, tempDir=None, nbrOfCPUs=None, nbrOfThreads=0, save2File=None, CopyPerfTab=True, Comments=False, Debug=False)
- Constructor
- actionOrder(self, action, ordering=None)
- Renders the order of a decision action in a given ordering
If ordering is None, the self.boostedOrder attribute is used.
- actionRank(self, action, ranking=None)
- Renders the rank of a decision action in a given ranking
If ranking is None, the self.boostedRanking attribute is used.
- computeActionCategories(self, action, Show=False, Debug=False, Comments=False, Threading=False, nbrOfCPUs=None, startMethod=None)
- Renders the union of categories in which the given action is sorted positively or null into.
Returns a tuple : action, lowest category key, highest category key, membership credibility !
- computeBoostedOrdering(self, orderingRule='Copeland')
- Renders an ordred list of decision actions ranked in
increasing preference direction following the orderingRule
on each component.
- computeBoostedRanking(self, rankingRule='Copeland')
- Renders an ordred list of decision actions ranked in
decreasing preference direction following the rankingRule
on each component.
- computeCategoryContents(self, Reverse=False, Comments=False, StoreSorting=True, Threading=False, nbrOfCPUs=None, startMethod=None)
- Computes the sorting results per category.
- computeCriterion2RankingCorrelation(self, criterion, Threading=False, nbrOfCPUs=None, startMethod=None, Debug=False, Comments=False)
- Renders the ordinal correlation coefficient between
the global linar ranking and the marginal criterion relation.
- computeMarginalVersusGlobalRankingCorrelations(self, Sorted=True, ValuedCorrelation=False, Threading=False, nbrCores=None, startMethod=None, Comments=False)
- Method for computing correlations between each individual criterion relation with the corresponding global ranking relation.
Returns a list of tuples (correlation,criterionKey) sorted by default in decreasing order of the correlation.
If Threading is True, a multiprocessing Pool class is used with a parallel equivalent of the built-in map function.
If nbrCores is not set, the os.cpu_count() function is used to determine the number of available cores.
- computeNewActionCategories(self, action, sorting, Debug=False, Comments=False)
- Renders the union of categories in which the given action is sorted positively or null into.
Returns a tuple : action, lowest category key, highest category key, membership credibility !
- computeNewSortingCharacteristics(self, actions, relation, Comments=False)
- Renders a bipolar-valued bi-dictionary relation
representing the degree of credibility of the
assertion that "actions x in A belongs to category c in C",
i.e. x outranks low category limit and does not outrank
the high category limit (if LowerClosed).
- showActionSortingResult(self, action)
- shows the quantiles sorting result all (default) of a subset of the decision actions.
- showActions(self)
- Prints out the actions disctionary.
- showComponents(self, direction='increasing')
- Shows the list of connected components of the digraph instance.
- showCriteria(self, IntegerWeights=False, Debug=False)
- print Criteria with thresholds and weights.
- showCriteriaQuantiles(self)
- showDecomposition(self, direction='decreasing')
- Prints on the console the decomposition structure of the sparse outranking digraph instance
in *decreasing* (default) or *increasing* preference direction.
- showMarginalVersusGlobalRankingCorrelation(self, Sorted=True, Threading=False, nbrOfCPUs=None, startMehod=None, Comments=True)
- Show method for computeCriterionCorrelation results.
- showNewActionCategories(self, action, sorting)
- Prints the union of categories in which the given action is sorted positively or null into.
- showNewActionsSortingResult(self, actions, sorting, Debug=False)
- shows the quantiles sorting result all (default) of a subset of the decision actions.
- showRelationTable(self, compKeys=None)
- Specialized for showing the quantiles decomposed relation table.
Components are stored in an ordered dictionary.
- showShort(self, fileName=None, WithFileSize=True)
- Default (__repr__) presentation method for big outranking digraphs instances:
>>> from sparseOutrankingDigraphs import *
>>> t = RandomCBPerformanceTableau(numberOfActions=100,seed=1)
>>> g = PreRankedOutrankingDigraph(t,quantiles=10)
>>> print(g)
*----- show short --------------*
Instance name : randomCBperftab_mp
Actions : 100
Criteria : 7
Sorting by : 10-Tiling
Ordering strategy : average
Ranking rule : Copeland
Components : 19
Minimal size : 1
Maximal size : 22
Median size : 2
fill rate : 0.116
---- Constructor run times (in sec.) ----
Total time : 0.14958
QuantilesSorting : 0.06847
Preordering : 0.00071
Decomposing : 0.07366
Ordering : 0.00130
- showSorting(self, Descending=True, isReturningHTML=False, Debug=False)
- Shows sorting results in decreasing or increasing (Reverse=False)
order of the categories. If isReturningHTML is True (default = False)
the method returns a htlm table with the sorting result.
Methods inherited from SparseOutrankingDigraph:
- __repr__(self)
- Default presentation method for pre-ranked sparse digraphs instances.
- computeDecompositionSummaryStatistics(self)
- Returns the summary of the distribution of the length of
the components as follows::
summary = {'max': maxLength,
'median':medianLength,
'mean':meanLength,
'stdev': stdLength,
'fillrate': fillrate,
(see computeFillRate()}
- computeDeterminateness(self)
- Computes the Kendalll distance in % of self
with the all median valued (indeterminate) digraph.
- computeFillRate(self)
- Renders the sum of the squares (without diagonal) of the orders of the component's subgraphs
over the square (without diagonal) of the big digraph order.
- computeOrderCorrelation(self, order, Debug=False)
- Renders the ordinal correlation K of a sparse digraph instance
when compared with a given linear order (from worst to best) of its actions
K = sum_{x != y} [ min( max(-self.relation(x,y)),other.relation(x,y), max(self.relation(x,y),-other.relation(x,y)) ]
K /= sum_{x!=y} [ min(abs(self.relation(x,y),abs(other.relation(x,y)) ]
.. note::
Renders a dictionary with the key 'correlation' containing the actual bipolar correlation index and the key 'determination' containing the minimal determination level D of self and the other relation.
D = sum_{x != y} min(abs(self.relation(x,y)),abs(other.relation(x,y)) / n(n-1)
where n is the number of actions considered.
The correlation index with a completely indeterminate relation
is by convention 0.0 at determination level 0.0 .
.. warning::
self must be a normalized outranking digraph instance !
- computeOrdinalCorrelation(self, other, Debug=False)
- Renders the ordinal correlation K of a SpareOutrakingDigraph instance
when compared with a given compatible (same actions set) other Digraph instance.
K = sum_{x != y} [ min( max(-self.relation(x,y)),other.relation(x,y), max(self.relation(x,y),-other.relation(x,y)) ]
K /= sum_{x!=y} [ min(abs(self.relation(x,y),abs(other.relation(x,y)) ]
.. note::
The global outranking relation of SparesOutrankingDigraph instances is contructed on the fly
from the ordered dictionary of the components.
Renders a dictionary with a 'correlation' key containing the actual bipolar correlation index K and a 'determination' key containing the minimal determination level D of self and the other relation, where
D = sum_{x != y} min(abs(self.relation(x,y)),abs(other.relation(x,y)) / n(n-1)
and where n is the number of actions considered.
The correlation index K with a completely indeterminate relation
is by convention 0.0 at determination level 0.0 .
- estimateRankingCorrelation(self, sampleSize=100, seed=1, Debug=False)
- exportGraphViz(self, fileName=None, actionsSubset=None, direction='decreasing', Comments=True, graphType='pdf', graphSize='7,7', fontSize=10, bgcolor='cornsilk', relation=None, Debug=False)
- Dummy for exportSortingDigraph.
- exportSortingGraphViz(self, fileName=None, actionsSubset=None, direction='decreasing', Comments=True, graphType='pdf', graphSize='7,7', fontSize=10, bgcolor='cornsilk', relation=None, Debug=False)
- export GraphViz dot file for weak order (Hasse diagram) drawing
filtering from SortingDigraph instances.
Example::
>>> # Testing graph viz export of sorting Hasse diagram
>>> MP = True
>>> nbrActions=100
>>> tp = RandomCBPerformanceTableau(numberOfActions=nbrActions,
... Threading=MP,
... seed=100)
>>> bg = PreRankedOutrankingDigraph(tp,CopyPerfTab=True,quantiles=20,
... quantilesOrderingStrategy='average',
... componentRankingRule='Copeland',
... LowerClosed=False,
... minimalComponentSize=1,
... Threading=MP,nbrOfCPUs=8,
... #tempDir='.',
... nbrOfThreads=8,
... Comments=False,Debug=False)
>>> print(bg)
*----- show short --------------*
Instance name : randomCBperftab_mp
# Actions : 100
# Criteria : 7
Sorting by : 20-Tiling
Ordering strategy : average
Ranking rule : Copeland
# Components : 36
Minimal order : 1
Maximal order : 11
Average order : 2.8
fill rate : 4.121%
---- Constructor run times (in sec.) ----
Total time : 0.15991
QuantilesSorting : 0.11717
Preordering : 0.00066
Decomposing : 0.04009
Ordering : 0.00000
>>> bg.showComponents()
*--- Relation decomposition in increasing order---*
35: ['a010']
34: ['a024', 'a060']
33: ['a012']
32: ['a018']
31: ['a004', 'a054', 'a075', 'a082']
30: ['a099']
29: ['a065']
28: ['a025', 'a027', 'a029', 'a041', 'a059']
27: ['a063']
26: ['a047', 'a066']
25: ['a021']
24: ['a007']
23: ['a044']
22: ['a037', 'a062', 'a090', 'a094', 'a098', 'a100']
21: ['a005', 'a040', 'a051', 'a093']
20: ['a015', 'a030', 'a052', 'a055', 'a064', 'a077']
19: ['a006', 'a061']
18: ['a049']
17: ['a001', 'a033']
16: ['a016', 'a028', 'a032', 'a035', 'a057', 'a079', 'a084', 'a095']
15: ['a043']
14: ['a002', 'a017', 'a023', 'a034', 'a067', 'a072', 'a073', 'a074', 'a088', 'a089', 'a097']
13: ['a048']
12: ['a078', 'a092']
11: ['a070']
10: ['a014', 'a026', 'a039', 'a058', 'a068', 'a083', 'a086']
9: ['a008', 'a022', 'a038', 'a081', 'a091', 'a096']
8: ['a020']
7: ['a069']
6: ['a045']
5: ['a003', 'a009', 'a013', 'a031', 'a036', 'a056', 'a076']
4: ['a042', 'a071']
3: ['a085']
2: ['a019', 'a080', 'a087']
1: ['a046']
0: ['a011', 'a050', 'a053']
>>> bg.exportSortingGraphViz(actionsSubset=bg.boostedRanking[:100])
.. image:: preRankedDigraph.png
:alt: pre-ranked digraph
:width: 400 px
:align: center
- htmlRelationMap(self, actionsSubset=None, tableTitle='Relation Map', relationName='r(x R y)', symbols=['+', '·', ' ', '-', '_'], Colored=True, ContentCentered=True)
- renders the relation map in actions X actions html table format.
- ordering2Preorder(self, ordering)
- Renders a preordering (a list of list) of a linar order (worst to best) of decision actions in increasing preference direction.
- ranking2Preorder(self, ranking)
- Renders a preordering (a list of list) of a ranking (best to worst) of decision actions in increasing preference direction.
- recodeValuation(self, newMin=-1, newMax=1, Debug=False)
- Specialization for recoding the valuation of all the partial digraphs and the component relation.
By default the valuation domain is normalized to [-1;1]
- relation(self, x, y, Debug=False)
- Dynamic construction of the global outranking characteristic function *r(x S y)*.
- showBestChoiceRecommendation(self, Comments=False, ChoiceVector=False, Debug=False)
- *Parameters*:
* Comments=False,
* ChoiceVector=False,
* Debug=False.
Update of rubisBestChoice Recommendation for big digraphs.
To do: limit to best choice; worst choice should be a separate method()
- showHTMLMarginalQuantileLimits(self, htmlFileName=None)
- shows the marginal quantiles limits.
- showHTMLRelationMap(self, actionsSubset=None, Colored=True, tableTitle='Relation Map', relationName='r(x S y)', symbols=['+', '·', ' ', '–', '—'], htmlFileName=None)
- Launches a browser window with the colored relation map of self.
- showHTMLRelationTable(self, actionsList=None, IntegerValues=False, ndigits=2, Colored=True, tableTitle='Valued Sparse Relation Table', relationName='r(x,y)', ReflexiveTerms=False, fromIndex=None, toIndex=None, htmlFileName=None)
- Launches a browser window with the colored relation table of self.
- showRelationMap(self, fromIndex=None, toIndex=None, symbols=None, actionsList=None)
- Prints on the console, in text map format, the location of
the diagonal outranking components of the sparse outranking digraph.
By default, symbols = {'max':'┬','positive': '+', 'median': ' ',
'negative': '-', 'min': '┴'}
Example::
>>> from sparseOutrankingDigraphs import *
>>> t = RandomCBPerformanceTableau(numberOfActions=50,seed=1)
>>> bg = PreRankedOutrankingDigraph(t,quantiles=10,minimalComponentSize=5)
>>> print(bg)
*----- show short --------------*
Instance name : randomCBperftab_mp
# Actions : 50
# Criteria : 7
Sorting by : 10-Tiling
Ordering strategy : average
Ranking Rule : Copeland
# Components : 7
Minimal size : 5
Maximal size : 13
Median size : 6
fill rate : 16.898%
---- Constructor run times (in sec.) ----
Total time : 0.08494
QuantilesSorting : 0.04339
Preordering : 0.00034
Decomposing : 0.03989
Ordering : 0.00024
>>> bg.showRelationMap()
┬+++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴ ++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
+ ++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
--- -┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
-┴-+ ┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴ ┬-+┬+┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴ +┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴+ + ┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴-+- ++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴ + ┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴ - ┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴ +++-+++++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴+ +++++++++-+┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴+- +--+++++++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴--+ -++++++-+┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴++++ +- ++ ┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴--+-+ +++++++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴-+-++- ++++--┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴-++-++- + -+-┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴---- ++- + ++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴-+--++++- -++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴--- --+++ ++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴+-+-++-+-+ +┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴-+- -+++-++ ┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ - + + ┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ -+ + ++┬++┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴++ +++++++++┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ -- -+-++ ┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴++++ ++++++-┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴----- ++-┬+┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ +++- -++-+┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴-----++ -++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ +-+-+-+ -++┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴+ +++ ┬+┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴-- --+++ -┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴--┴+ -┴--+ ┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ +++++++┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴+ +++-+┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴-- +++┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴-- ++┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴+-+ +++┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ +- + --┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴---+++ +┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴- ┴-+++ ┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ ┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ ++ ┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ - -┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ -+ ┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ ┴ ┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴
Component ranking rule: Copeland
>>>
- showRubisBestChoiceRecommendation(self, Comments=False, ChoiceVector=False, Debug=False)
- Dummy for self.showBestChoiceRecommendation() method.
- sortingRelation(self, x, y, Debug=False)
- Dynamic construction of the quantiles sorting characteristic function *r(x QS y)*.
Methods inherited from outrankingDigraphs.BipolarOutrankingDigraph:
- computeCriterionRelation(self, c, a, b, hasSymmetricThresholds=True)
- Compute the outranking characteristic for actions x and y
on criterion c.
- computeSingleCriteriaNetflows(self)
- renders the Promethee single criteria netflows matrix M
- criterionCharacteristicFunction(self, c, a, b, hasSymmetricThresholds=True)
- Renders the characteristic value of the comparison of a and b on criterion c.
- saveSingleCriterionNetflows(self, fileName='tempnetflows.prn', delimiter=' ', Comments=True)
- Delimited save of single criteria netflows matrix
Methods inherited from outrankingDigraphs.OutrankingDigraph:
- computeAMPLData(self, OldValuation=False)
- renders the ampl data list
- computeActionsComparisonCorrelations(self)
- renders the comparison correlations between the actions
- computeActionsCorrelationDigraph(self)
- renders the pairwise actions comparison digraph
- computeCriteriaComparisonCorrelations(self)
- renders the comparison correlations between the criteria
- computeCriteriaCorrelationDigraph(self, ValuedCorrelation=True, WithMedian=False)
- renders the ordinal criteria correlation digraph.
- computeCriteriaCorrelations(self, ValuedCorrelation=False)
- renders the relation equivalence or correlation between the criteria
- computeCriterionCorrelation(self, criterion, Threading=False, nbrOfCPUs=None, Debug=False, Comments=False)
- Renders the ordinal correlation coefficient between
the global outranking and the marginal criterion relation.
Uses the digraphs.computeOrdinalCorrelationMP().
.. note::
Renders a dictionary with the key 'correlation' containing the actual bipolar correlation index and the key 'determination' containing the minimal determination level D of the self outranking and the marginal criterion relation.
D = sum_{x != y} min(abs(self.relation(x,y)),abs(marginalCriterionRelation(x,y)) / n(n-1)
where n is the number of actions considered.
The correlation index with a completely indeterminate relation
is by convention 0.0 at determination level 0.0 .
- computeMarginalCorrelation(self, args, Threading=False, nbrOfCPUs=None, Debug=False, Comments=False)
- Renders the ordinal correlation coefficient between
the marginal criterion relation and a
given normalized outranking relation.
args = (criterion,relation)
- computeMarginalObjectiveCorrelation(self, args, Threading=False, nbrOfCPUs=None, Debug=False, Comments=False)
- Renders the ordinal correlation coefficient between
the marginal criterion relation and a
given normalized outranking relation.
args = (objective,relation)
- computeMarginalObjectivesVersusGlobalRankingCorrelations(self, ranking, Sorted=True, ValuedCorrelation=False, Threading=False, nbrCores=None, startMethod=None, Comments=False)
- Method for computing correlations between each individual objective's outranking relation and the given global ranking relation.
Returns a list of tuples (correlation,objectiveKey) sorted by default in decreasing order of the correlation.
If Threading is True, a multiprocessing Pool class is used with a parallel equivalent of the built-in map function.
If nbrCores is not set, the os.cpu_count() function is used to determine the number of available cores.
*Usage example*:
>>> from outrankingDigraphs import *
>>> t = Random3ObjectivesPerformanceTableau(
numberOfActions=21,
numberOfCriteria=17,
vetoProbability=0.2,
seed=12)
>>> g = BipolarOutrankingDigraph(t)
>>> ranking = g.computeNetFlowsRanking()
>>> g.computeMarginalObjectivesVersusGlobalRankingCorrelations(
ranking,Threading=False,Comments=True)
Marginal objective ordinal correlation with given ranking
-------------------------------------------------
Given ranking: ['p04', 'p09', 'p01', 'p08', 'p16', 'p03',
'p13', 'p20', 'p15', 'p10', 'p18', 'p19',
'p06', 'p02', 'p07', 'p11', 'p05', 'p12',
'p14', 'p21', 'p17']
Objective (weight): correlation
Soc (135.00): +0.473
Eco (135.00): +0.457
Env (135.00): +0.326
- computeMarginalVersusGlobalOutrankingCorrelations(self, Sorted=True, ValuedCorrelation=False, Threading=False, nbrCores=None, startMethod=None, Comments=False)
- Method for computing correlations between each individual criterion relation with the corresponding
global outranking relation.
Returns a list of tuples (correlation,criterionKey) sorted by default in decreasing order of the correlation.
If Threading is True, a multiprocessing Pool class is used with a parallel equivalent of the built-in map function.
If nbrCores is not set, the os.cpu_count() function is used to determine the number of
available cores.
- computeOutrankingConsensusQuality(self, Sorted=True, ValuedCorrelation=True, Threading=False, nbrCores=None, Comments=False)
- Renders the marginal criteria correlations with the corresponding global outranking relation with summary.
- computePairwiseComparisons(self, hasSymmetricThresholds=True)
- renders pairwise comparison parameters for all pairs of actions
- computePairwiseCompleteComparison(self, a, b, c)
- renders pairwise complete comparison parameters for actions a and b
on criterion c.
- computePairwiseOddsMatrix(self)
- renders a double dictionary with odds:
(positive chaacteristics, negative characteristics)
per actions pair.
- computeQuantileSortRelation(self, Debug=False)
- Renders the bipolar-valued relation obtained from
the self quantile sorting result.
- computeSingletonRanking(self, Comments=False, Debug=False)
- Renders the sorted bipolar net determinatation of outrankingness
minus outrankedness credibilities of all singleton choices.
res = ((netdet,singleton,dom,absorb)+)
- computeVetoesStatistics(self, level=None)
- renders the cut level vetos in dictionary format:
vetos = {'all': n0, 'strong: n1, 'weak':n2}.
- computeVetosShort(self)
- renders the number of vetoes and real vetoes in an OutrankingDigraph.
- computeWeightsConcentrationIndex(self)
- Renders the Gini concentration index of the weight distribution
Based on the triangle summation formula.
- defaultDiscriminationThresholds(self, quantile={'ind': 10, 'pref': 20, 'weakVeto': 60, 'veto': 80}, Debug=False, comments=False)
- updates the discrimination thresholds with the percentiles
from the performance differences.
Parameters:
quantile = {'ind': 10, 'pref': 20, 'weakVeto': 60, 'veto: 80}.
- export3DplotOfActionsCorrelation(self, plotFileName='actCorr', graphType=None, pictureFormat='pdf', bgcolor='cornsilk', Comments=False)
- Using R for producing a plot -pdf format by default- of the principal components of
the actions ordinal correlation table.
See export3DplotCriteriaCorrelation()
- export3DplotOfCriteriaCorrelation(self, plotFileName='critCorr', tempDir='.', graphType=None, pictureFormat='pdf', bgcolor='cornsilk', ValuedCorrelation=False, WithMedian=False, Comments=False)
- Using R for producing a plot (pdf format by default) of the principal components of
the criteria ordinal correlation table.
*Parameters*:
* *plotFileName* := name of the created R plot image,
* *pictureFormat* := 'png' (default) | 'pdf' | 'jpeg' | 'xfig',
* *graphType* := deprecated
* *bgcolor* := 'cornsilk' by default | None,
* *ValuedCorrelation* := False (tau by default) | True (r(<=>) otherwise,
* *WithMedian* includes the marginal correlation with the global outranking relation
* *tempDir* := '.' : default current working directory.
- saveActionsCorrelationTable(self, fileName='tempcorr.prn', delimiter=' ', Bipolar=True, Silent=False, Centered=False)
- Delimited save of correlation table
- saveCriteriaCorrelationTable(self, fileName='tempcorr.prn', delimiter=' ', ValuedCorrelation=False, Bipolar=True, Silent=False, Centered=False)
- Delimited save of correlation table
- saveXMCDA2RubisChoiceRecommendation(self, fileName='temp', category='Rubis', subcategory='Choice Recommendation', author='digraphs Module (RB)', reference='saved from Python', comment=True, servingD3=False, relationName='Stilde', graphValuationType='bipolar', variant='standard', instanceID='void', stringNA='NA', _OldCoca=True, Debug=False)
- save complete Rubis problem and result in XMCDA 2.0 format with unicode encoding.
*Warning*: obsolete now!
- showAll(self)
- specialize the general showAll method with criteria
and performance tableau output
- showConsiderablePerformancesPolarisation(self)
- prints all considerable performance polarisations.
- showCriteriaCorrelationTable(self, ValuedCorrelation=False, isReturningHTML=False, ndigits=3)
- prints the ordinal correlation index tau between criteria in table format.
- showCriteriaHierarchy(self)
- shows the Rubis clustering of the ordinal criteria correlation table
- showCriterionRelationTable(self, criterion, actionsSubset=None)
- prints the relation valuation in actions X actions table format.
- showHTMLPairwiseComparison(self, a, b, htmlFileName=None)
- Exporting the pairwise comparison table of actions a and b in the default system browser. A specific file name may be provided.
- showHTMLPairwiseOutrankings(self, a, b, htmlFileName=None)
- Exporting the pairwise outrankings table of actions a and b
in the default system browser. A specific file name may be provided.
- showMarginalObjectivesVersusGlobalRankingCorrelations(self, ranking, Sorted=True, ValuedCorrelation=False, Threading=False, nbrCores=None)
- Corresponding compute method with Comments = True flag.
- showMarginalVersusGlobalOutrankingCorrelation(self, Sorted=True, ValuedCorrelation=False, Threading=False, nbrOfCPUs=None, Comments=True)
- Show method for computeCriterionCorrelation results.
- showOldPairwiseComparison(self, a, b, Debug=False, isReturningHTML=False, hasSymmetricThresholds=True)
- Obsolete: Renders the pairwise comprison parameters on all criteria
with weak preference and weak veto thresholds.
- showOutrankingConsensusQuality(self, Sorted=True, ValuedCorrelation=True, Threading=False, nbrCores=None, Comments=True)
- Show method for the computeOutrankingConsensusQuality() method.
- showPairwiseComparison(self, a, b, Debug=False, isReturningHTML=False, hasSymmetricThresholds=True)
- Renders the pairwise comprison parameters on all criteria
in html format
- showPairwiseComparisonsDistributions(self)
- Renders the lt,leq, eq, geq, gt distributions for all pairs
- showPairwiseOutrankings(self, a, b, Debug=False, isReturningHTML=False, hasSymmetricThresholds=True)
- Renders the pairwise outrankings table for actions *a* and *b*.
- showPerformanceTableau(self, actionsSubset=None)
- Print the performance Tableau.
- showPolarisations(self, cutLevel=None, realVetosOnly=False)
- prints all negative and positive polarised situations observed in the OutrankingDigraph instance.
- showSingletonRanking(self, Comments=True, Debug=False)
- Calls self.computeSingletonRanking(comments=True,Debug = False).
Renders and prints the sorted bipolar net determinatation of outrankingness
minus outrankedness credibilities of all singleton choices.
res = ((netdet,sigleton,dom,absorb)+)
- showVetos(self, cutLevel=None, realVetosOnly=False)
- prints all veto and counter-veto situations observed in the OutrankingDigraph instance.
Methods inherited from digraphs.Digraph:
- MISgen(self, S, I)
- generator of maximal independent choices (voir Byskov 2004):
* S ::= remaining nodes;
* I ::= current independent choice
.. note::
Inititalize: self.MISgen(self.actions.copy(),set())
- __invert__(self)
- Make the inverting operator ~self available for Digraph instances.
Returns a ConverseDigraph instance of self.
- __neg__(self)
- Make the negation operator -self available for Digraph instances.
Returns a DualDigraph instance of self.
- absirred(self, choice)
- Renders the crips -irredundance degree of a choice.
- absirredundant(self, U)
- Generates all -irredundant choices of a digraph.
- absirredval(self, choice, relation)
- Renders the valued -irredundance degree of a choice.
- absirredx(self, choice, x)
- Computes the crips -irredundance degree of node x in a choice.
- abskernelrestrict(self, prekernel)
- Parameter: prekernel
Renders absorbent prekernel restricted relation.
- absorb(self, choice)
- Renders the absorbency degree of a choice.
- absorbentChoices(self, S)
- Generates all minimal absorbent choices of a bipolar valued digraph.
- addValuationAttribute(self)
- Adds the numpy valuation attribute
- agglomerationDistribution(self)
- Output: aggloCoeffDistribution, meanCoeff
Renders the distribution of agglomeration coefficients.
- aneighbors(self, node)
- Renders the set of absorbed in-neighbors of a node.
- automorphismGenerators(self)
- Adds automorphism group generators to the digraph instance.
.. note::
Dependency: Uses the dreadnaut command from the nauty software package. See https://www3.cs.stonybrook.edu/~algorith/implement/nauty/implement.shtml
On Ubuntu Linux:
...$ sudo apt-get install nauty
- averageCoveringIndex(self, choice, direction='out')
- Renders the average covering index of a given choice in a set of objects,
ie the average number of choice members that cover each
non selected object.
- bipolarKCorrelation(self, digraph, Debug=False)
- Renders the bipolar Kendall correlation between two bipolar valued
digraphs computed from the average valuation of the
XORDigraph(self,digraph) instance.
.. warning::
Obsolete! Is replaced by the self.computeBipolarCorrelation(other) Digraph method
- bipolarKDistance(self, digraph, Debug=False)
- Renders the bipolar crisp Kendall distance between two bipolar valued
digraphs.
.. warning::
Obsolete! Is replaced by the self.computeBipolarCorrelation(other, MedianCut=True) Digraph method
- chordlessPaths(self, Pk, n2, Odd=False, Comments=False, Debug=False)
- New procedure from Agrum study April 2009
recursive chordless path extraction starting from path
Pk = [n2, ...., n1] and ending in node n2.
Optimized with marking of visited chordless P1s.
- circuitAverageCredibility(self, circ)
- Renders the average linking credibility of a Chordless Circuit.
- circuitCredibilities(self, circuit, Debug=False)
- Renders the average linking credibilities and the minimal link of a Chordless Circuit.
- circuitMaxCredibility(self, circ)
- Renders the maximal linking credibility of a Chordless Circuit.
- circuitMinCredibility(self, circ)
- Renders the minimal linking credibility of a Chordless Circuit.
- closeSymmetric(self, InSite=True)
- Produces the symmetric closure of self.relation.
- closeTransitive(self, Reverse=False, InSite=True, Comments=False)
- Produces the transitive closure of self.relation.
*Parameters*:
- If *Reverse* == True (False default) all transitive links are dropped, otherwise all transitive links are closed with min[r(x,y),r(y,z)];
- If *Insite* == False (True by default) the methods return a modified copy of self.relation without altering the original self.relation, otherwise self.relation is modified.
- components(self)
- Renders the list of connected components.
- computeAllDensities(self, choice=None)
- parameter: choice in self
renders six densitiy parameters:
arc density, double arc density,
single arc density, strict single arc density,
absence arc density, strict absence arc densitiy.
- computeArrowRaynaudOrder(self)
- Renders a linear ordering from worst to best of the actions following Arrow&Raynaud's rule.
- computeArrowRaynaudRanking(self)
- renders a linear ranking from best to worst of the actions following Arrow&Raynaud's rule.
- computeAverageValuation(self)
- Computes the bipolar average correlation between
self and the crisp complete digraph of same order
of the irreflexive and determined arcs of the digraph
- computeBadChoices(self, Comments=False)
- Computes characteristic values for potentially bad choices.
.. note::
Returns a tuple with following content:
[(0)-determ,(1)degirred,(2)degi,(3)degd,(4)dega,(5)str(choice),(6)absvec]
- computeBadPirlotChoices(self, Comments=False)
- Characteristic values for potentially bad choices
using the Pirlot's fixpoint algorithm.
- computeBestChoiceRecommendation(self, Verbose=False, Comments=False, ChoiceVector=False, CoDual=True, Debug=False, _OldCoca=False, BrokenCocs=True)
- Sets self.bestChoice, self.bestChoiceData, self.worstChoice and self.worstChoiceData
with the showBestChoiceRecommendation method.
First and last choices data is the following:
[(0)-determ,(1)degirred,(2)degi,(3)degd,(4)dega,(5)str(choice),(6)domvec,(7)cover]
self.bestChoice = self.bestChoiceData[5]
self.worstChoice = self.worstChoiceData[5]
- computeBipolarCorrelation(self, other, MedianCut=False, filterRelation=None, Debug=False)
- obsolete: dummy replacement for Digraph.computeOrdinalCorrelation method
- computeChordlessCircuits(self, Odd=False, Comments=False, Debug=False)
- Renders the set of all chordless circuits detected in a digraph.
Result is stored in <self.circuitsList>
holding a possibly empty list of tuples with at position 0 the
list of adjacent actions of the circuit and at position 1
the set of actions in the stored circuit.
When *Odd* is True, only chordless circuits with an odd length
are collected.
- computeChordlessCircuitsMP(self, Odd=False, Threading=False, nbrOfCPUs=None, startMethod=None, Comments=False, Debug=False)
- Multiprocessing version of computeChordlessCircuits().
Renders the set of all chordless odd circuits detected in a digraph.
Result (possible empty list) stored in <self.circuitsList>
holding a possibly empty list tuples with at position 0 the
list of adjacent actions of the circuit and at position 1
the set of actions in the stored circuit.
Inspired by Dias, Castonguay, Longo, Jradi, Algorithmica (2015).
Returns a possibly empty list of tuples (circuit,frozenset(circuit)).
If Odd == True, only circuits of odd length are retained in the result.
- computeCoSize(self)
- Renders the number of non validated non reflexive arcs
- computeConcentrationIndex(self, X, N)
- Renders the Gini concentration index of the X serie.
N contains the partial frequencies.
Based on the triangle summation formula.
- computeConcentrationIndexTrapez(self, X, N)
- Renders the Gini concentration index of the X serie.
N contains the partial frequencies.
Based on the triangles summation formula.
- computeCondorcetLosers(self)
- Wrapper for condorcetLosers().
- computeCondorcetWinners(self)
- Wrapper for condorcetWinners().
- computeCopelandOrder(self)
- renders a linear ordering from worst to best of the actions following Arrow&Raynaud's rule.
- computeCopelandRanking(self)
- renders a linear ranking from best to worst of the actions following Arrow&Raynaud's rule.
- computeCutLevelDensities(self, choice, level)
- parameter: choice in self, robustness level
renders three robust densitiy parameters:
robust double arc density,
robust single arc density,
robust absence arc densitiy.
- computeDensities(self, choice)
- parameter: choice in self
renders the four densitiy parameters:
arc density, double arc density, single arc density, absence arc density.
- computeDiameter(self, Oriented=True)
- Renders the (by default oriented) diameter of the digraph instance
- computeDigraphCentres(self, WeakDistances=False, Comments=False)
- The centers of a digraph are the nodes with finite minimal shortes path lengths.
The maximal neighborhood distances are stored in *self.maximalNeighborhoodDistances*.
The corresponding digraph radius and diameter are stored respectively in *self.radius* and *self.diameter*.
With *Comments* = True, all these results are printed out.
*Source*: Claude Berge, *The Theory of Graphs*, Dover (2001) pp. 119, original in French Dunod (1958)
- computeDynamicProgrammingStages(self, source, sink, Debug=False)
- Renders the discrete stages of the optimal substructure for
dynamic pogramming digrahs from a given source node
to a given sink sink node.
Returns a list of list of action identifyers.
- computeGoodChoiceVector(self, ker, Comments=False)
- | Computing Characteristic values for dominant pre-kernels
| using the von Neumann dual fixoint equation
- computeGoodChoices(self, Comments=False)
- Computes characteristic values for potentially good choices.
..note::
Return a tuple with following content:
[(0)-determ,(1)degirred,(2)degi,(3)degd,(4)dega,(5)str(choice),(6)domvec,(7)cover]
- computeGoodPirlotChoices(self, Comments=False)
- Characteristic values for potentially good choices
using the Pirlot fixpoint algorithm.
- computeIncomparabilityDegree(self, InPercents=False, Comments=False)
- Renders the incomparability degree (Decimal), i.e. the relative number of symmetric indeterminate relations of the irreflexive part of a digraph.
- computeKemenyIndex(self, otherRelation)
- renders the Kemeny index of the self.relation
compared with a given crisp valued relation of a compatible
other digraph (same nodes or actions).
- computeKemenyOrder(self, orderLimit=7, Debug=False)
- Renders a ordering from worst to best of the actions with maximal Kemeny index.
Return a tuple: kemenyOrder (from worst to best), kemenyIndex
- computeKemenyRanking(self, orderLimit=7, seed=None, sampleSize=1000, Debug=False)
- Renders a ranking from best to worst of the actions with maximal Kemeny index.
.. note::
Returns a tuple: kemenyRanking (from best to worst), kemenyIndex.
- computeKernelVector(self, kernel, Initial=True, Comments=False)
- | Computing Characteristic values for dominant pre-kernels
| using the von Neumann dual fixpoint equation
- computeKohlerOrder(self)
- Renders an ordering (worst to best) of the actions following Kohler's rule.
- computeKohlerRanking(self)
- Renders a ranking (best to worst) of the actions following Kohler's rule.
- computeMaxHoleSize(self, Comments=False)
- Renders the length of the largest chordless cycle
in the corresponding disjunctive undirected graph.
- computeMeanInDegree(self)
- Renders the mean indegree of self.
!!! self.size must be set previously !!!
- computeMeanOutDegree(self)
- Renders the mean degree of self.
!!! self.size must be set previously !!!
- computeMeanSymDegree(self)
- Renders the mean degree of self.
!!! self.size must be set previously !!!
- computeMedianOutDegree(self)
- Renders the median outdegree of self.
!!! self.size must be set previously !!!
- computeMedianSymDegree(self)
- Renders the median symmetric degree of self.
!!! self.size must be set previously !!!
- computeMoreOrLessUnrelatedPairs(self)
- Renders a list of more or less unrelated pairs.
- computeNetFlowsOrder(self)
- Renders an ordered list (from best to worst) of the actions
following the net flows ranking rule.
- computeNetFlowsOrderDict(self)
- Renders an ordered list (from worst to best) of the actions
following the net flows ranking rule.
- computeNetFlowsRanking(self)
- Renders an ordered list (from best to worst) of the actions
following the net flows ranking rule.
- computeNetFlowsRankingDict(self)
- Renders an ordered list (from best to worst) of the actions
following the net flows ranking rule.
- computeODistance(self, op2, comments=False)
- renders the squared normalized distance of
two digraph valuations.
.. note::
op2 = digraphs of same order as self.
- computeOrbit(self, choice, withListing=False)
- renders the set of isomorph copies of a choice following
the automorphism of the digraph self
- computeOrdinalCorrelationMP(self, other, MedianCut=False, Threading=False, nbrOfCPUs=None, startMethod=None, Comments=False, Debug=False)
- Multi processing version of the digraphs.computeOrdinalCorrelation() method.
.. note::
The relation filtering and the MedinaCut option are not implemented in the MP version.
- computePairwiseClusterComparison(self, K1, K2, Debug=False)
- Computes the pairwise cluster comparison credibility vector
from bipolar-valued digraph g. with K1 and K2 disjoint
lists of action keys from g actions disctionary.
Returns the dictionary
{'I': Decimal(),'P+':Decimal(),'P-':Decimal(),'R' :Decimal()}
where one and only one item is strictly positive.
- computePreKernels(self)
- computing dominant and absorbent preKernels:
Result in self.dompreKernels and self.abspreKernels
- computePreRankingRelation(self, preRanking, Normalized=True, Debug=False)
- Renders the bipolar-valued relation obtained from
a given preRanking in decreasing levels (list of lists) result.
- computePreorderRelation(self, preorder, Normalized=True, Debug=False)
- Renders the bipolar-valued relation obtained from
a given preordering in increasing levels (list of lists) result.
- computePrincipalOrder(self, Colwise=False, Comments=False)
- Rendesr an ordering from wrost to best of the decision actions.
- computePrincipalRanking(self, Colwise=False, Comments=False)
- Rendesr a ranking from best to worst of the decision actions.
- computePrincipalScores(self, plotFileName=None, Colwise=False, imageType=None, tempDir=None, bgcolor='cornsilk', Comments=False, Debug=False)
- Renders a ordered list of the first principal eigenvector of the covariance of the valued outdegrees of self.
.. note::
The method, relying on writing and reading temporary files by default in a temporary directory is threading and multiprocessing safe !
(see Digraph.exportPrincipalImage method)
- computePrudentBetaLevel(self, Debug=False)
- computes alpha, ie the lowest valuation level, for which the
bipolarly polarised digraph doesn't contain a chordless circuit.
- computeRankingByBestChoosing(self, CoDual=False, Debug=False)
- Computes a weak preordering of the self.actions by recursive
best choice elagations.
Stores in self.rankingByBestChoosing['result'] a list of (P+,bestChoice) tuples
where P+ gives the best choice complement outranking
average valuation via the computePairwiseClusterComparison
method.
If self.rankingByBestChoosing['CoDual'] is True,
the ranking-by-choosing was computed on the codual of self.
- computeRankingByBestChoosingRelation(self, rankingByBestChoosing=None, Debug=False)
- Renders the bipolar-valued relation obtained from
the self.rankingByBestChoosing result.
- computeRankingByChoosing(self, actionsSubset=None, Debug=False, CoDual=False)
- Computes a weak preordring of the self.actions by iterating
jointly first and last choice elagations.
Stores in self.rankingByChoosing['result'] a list of ((P+,bestChoice),(P-,worstChoice)) pairs
where P+ (resp. P-) gives the best (resp. worst) choice complement outranking
(resp. outranked) average valuation via the computePairwiseClusterComparison
method.
If self.rankingByChoosing['CoDual'] is True, the ranking-by-choosing was computed on the codual of self.
- computeRankingByChoosingRelation(self, rankingByChoosing=None, actionsSubset=None, Debug=False)
- Renders the bipolar-valued relation obtained from
the self.rankingByChoosing result.
- computeRankingByLastChoosing(self, CoDual=False, Debug=False)
- Computes a weak preordring of the self.actions by iterating
worst choice elagations.
Stores in self.rankingByLastChoosing['result'] a list of (P-,worstChoice) pairs
where P- gives the worst choice complement outranked
average valuation via the computePairwiseClusterComparison
method.
If self.rankingByChoosing['CoDual'] is True, the ranking-by-last-chossing
was computed on the codual of self.
- computeRankingByLastChoosingRelation(self, rankingByLastChoosing=None, Debug=False)
- Renders the bipolar-valued relation obtained from
the self.rankingByLastChoosing result.
- computeRankingCorrelation(self, ranking, Debug=False)
- Renders the ordinal correlation K of a digraph instance
when compared with a given linear ranking of its actions
K = sum_{x != y} [ min( max(-self.relation(x,y)),other.relation(x,y), max(self.relation(x,y),-other.relation(x,y)) ]
K /= sum_{x!=y} [ min(abs(self.relation(x,y),abs(other.relation(x,y)) ]
.. note::
Renders a tuple with at position 0 the actual bipolar correlation index
and in position 1 the minimal determination level D of self and
the other relation.
D = sum_{x != y} min(abs(self.relation(x,y)),abs(other.relation(x,y)) / n(n-1)
where n is the number of actions considered.
The correlation index with a completely indeterminate relation
is by convention 0.0 at determination level 0.0 .
- computeRelationalStructure(self, Debug=False)
- Renders the counted decomposition of the valued relations into
the following type of links:
gt '>', eq '=', lt '<', incomp '<>',
leq '<=', geq '>=', indeterm '?'
- computeRubisChoice(self, Comments=False, _OldCoca=False, BrokenCocs=True, Threading=False, nbrOfCPUs=1)
- Renders self.strictGoodChoices, self.nullChoices
self.strictBadChoices, self.nonRobustChoices.
.. warning::
Changes in site the outranking digraph by
adding or braking chordless odd outranking circuits.
- computeRubyChoice(self, Comments=False, _OldCoca=False)
- dummy for computeRubisChoice()
old versions compatibility.
- computeShortestPathLengths(self, WeakPaths=False, Comments=False, Debug=False)
- Renders a double dictionary with the directed distances, i.e. the shortest path lengths between all self.actions.
Equals *None* if there does not exist a directed path between two actions.
*Source*: Claude Berge, *The Theory of Graphs*, Dover (2001) pp. 119, original in French Dunod (1958)
- computeSize(self)
- Renders the number of validated non reflexive arcs
- computeSizeTransitiveClosure(self)
- Renders the size of the transitive closure of a digraph.
- computeSlaterOrder(self, isProbabilistic=False, seed=None, sampleSize=1000, Debug=False)
- Reversed return from computeSlaterRanking method.
- computeSlaterRanking(self, isProbabilistic=False, seed=None, sampleSize=1000, Debug=False)
- Renders a ranking of the actions with minimal Slater index.
Return a tuple: slaterOrder, slaterIndex
- computeSymmetryDegree(self, InPercents=False, Comments=False)
- Renders the symmetry degree (Decimal) of the irreflexive part of a digraph.
.. note::
Empty and indeterminate digraphs are considered to be symmetric.
- computeTopologicalRanking(self, Debug=False)
- Mimetic Wrapper of the topologicalSort() method.
- computeTransitivityDegree(self, InPercents=False, Comments=False)
- Renders the transitivity degree (Decimal) of a digraph.
.. note::
An empty or indeterminate digraph is considered to be transitive.
- computeUnrelatedPairs(self)
- Renders a list of more or less unrelated pairs.
- computeValuationLevels(self, choice=None, Debug=False)
- renders the symmetric closure of the
apparent valuations levels of self
in an increasingly ordered list.
If parameter choice is given, the
computation is limited to the actions
of the choice.
- computeValuationPercentages(self, choice, percentiles, withValues=False)
- Parameters: choice and list of percentiles.
renders a series of percentages of the characteristics valuation of
the arcs in the digraph.
- computeValuationPercentiles(self, choice, percentages, withValues=False)
- Parameters: choice and list of percentages.
renders a series of quantiles of the characteristics valuation of
the arcs in the digraph.
- computeValuationStatistics(self, Sampling=False, Comments=False)
- Renders the mean and variance of the valuation
of the non reflexive pairs.
- computeValuedRankingRelation(self, ranking)
- Renders the valued relation characteristics compatible
with the given linar ranking. Discordant charcateristics
are set to the indeterminate value.
- computeWeakCondorcetLosers(self)
- Wrapper for weakCondorcetLosers().
- computeWeakCondorcetWinners(self)
- Wrapper for weakCondorcetWinners().
- computeupdown1(self, s, S)
- Help method for show_MIS_HB2 method.
fills self.newmisset, self.upmis, self.downmis.
- computeupdown2(self, s, S)
- Help method for show_MIS_HB1 method.
Fills self.newmisset, self.upmis, self.downmis.
- computeupdown2irred(self, s, S)
- Help method for show_MIS_HB1 method.
Fills self.newmisset, self.upmis, self.downmis.
- condorcetLosers(self)
- Renders the set of decision actions x such that
self.relation[x][y] < self.valuationdomain['med']
for all y != x.
- condorcetWinners(self)
- Renders the set of decision actions x such that
self.relation[x][y] > self.valuationdomain['med']
for all y != x.
- contra(self, v)
- Parameter: choice.
Renders the negation of a choice v characteristic's vector.
- convertRelationToDecimal(self)
- Converts the float valued self.relation in a decimal valued one.
- convertValuation2Integer(self, InSite=True, Comments=False)
- Converts the self.relation valuation to integer values by converting the Decimals to Fractions and multiply by the least commun multiple of the fraction denominators.
*Parameters*:
- If *Insite* == False (True by default) the method returns a modified copy of self.relation without altering the original self.relation, otherwise self.relation and self.valuationdomain is modified.
- convertValuationToDecimal(self)
- Convert the float valuation limits to Decimals.
- coveringIndex(self, choice, direction='out')
- Renders the covering index of a given choice in a set of objects,
ie the minimum number of choice members that cover each
non selected object.
- crispKDistance(self, digraph, Debug=False)
- Renders the crisp Kendall distance between two bipolar valued
digraphs.
.. warning::
Obsolete! Is replaced by the self.computeBipolarCorrelation(other, MedianCut=True) Digraph method
- detectChordlessCircuits(self, Comments=False, Debug=False)
- Detects a chordless circuit in a digraph.
Returns a Boolean
- detectChordlessPath(self, Pk, n2, Comments=False, Debug=False)
- New procedure from Agrum study April 2009
recursive chordless path extraction starting from path
Pk = [n2, ...., n1] and ending in node n2.
Optimized with marking of visited chordless P1s.
- determinateness(self, vec, inPercent=True)
- Renders the determinateness of a characteristic vector *vec* =
[(r(x),x),(r(y),y), ...] of length *n* in valuationdomain [Min,Med,Max]:
*result* = sum_x( abs(r(x)-Med) ) / ( n*(Max-Med) )
If inPercent, *result* shifted (+1) and reduced (/2) to [0,1] range.
- digraph2Graph(self, valuationDomain={'min': -1, 'med': 0, 'max': 1}, Debug=False, ConjunctiveConversion=True)
- Convert a Digraph instance to a Graph instance.
- dneighbors(self, node)
- Renders the set of dominated out-neighbors of a node.
- domin(self, choice)
- Renders the dominance degree of a choice.
- dominantChoices(self, S)
- Generates all minimal dominant choices of a bipolar valued digraph.
.. note::
Initiate with S = self.actions.copy().
- domirred(self, choice)
- Renders the crips +irredundance degree of a choice.
- domirredval(self, choice, relation)
- Renders the valued +irredundance degree of a choice.
- domirredx(self, choice, x)
- Renders the crips +irredundance degree of node x in a choice.
- domkernelrestrict(self, prekernel)
- Parameter: dominant prekernel
Renders dominant prekernel restricted relation.
- exportPrincipalImage(self, plotFileName=None, pictureFormat='pdf', bgcolor='cornsilk', fontcolor='red3', fontsize='0.75', Reduced=False, Colwise=False, tempDir='.', Comments=False)
- Export as PDF (default) the principal projection of
the valued relation using the three principal eigen vectors.
Implemeted picture formats are:
'pdf' (default), 'png', 'jpeg' and 'xfig'.
The background color is set by default to 'cornsilk'.
Font size and color are set by default to 'red3', resp. '0.75'.
When *Reduced==True*, the valued relation characeteristics are centered and reduced.
When *Colwise==True*, the column vectors of the adjacency table are used for the principal projection, otherwise the rows (default) are used. Has no incidence when the *Digraph* instance *self* is symmetric.
.. warning::
The method, writing and reading temporary files:
tempCol.r and rotationCol.csv, resp. tempRow.r and rotationRow.csv,
by default in the working directory (./),
is hence not safe for multiprocessing programs, unless a
temporary directory *tempDir* is provided.
- flatChoice(self, ch, Debug=False)
- Converts set or list ch recursively to a flat list of items.
- forcedBestSingleChoice(self)
- Renders the set of most determined outranking singletons in self.
- gammaSets(self)
- Renders the dictionary of neighborhoods {node: (dx,ax)}
with set *dx* gathering the dominated, and set *ax* gathering
the absorbed neighborhood.
- generateAbsPreKernels(self)
- Generate all absorbent prekernels from independent choices generator.
- generateDomPreKernels(self)
- Generate all dominant prekernels from independent choices generator.
- htmlChoiceVector(self, ch, ChoiceVector=True, choiceType='good')
- Show procedure for annotated bipolar choices.
- inDegrees(self)
- renders the median cut indegrees
- inDegreesDistribution(self)
- Renders the distribution of indegrees.
- independentChoices(self, U)
- Generator for all independent choices with neighborhoods of a bipolar valued digraph:
.. note::
* Initiate with U = self.singletons().
* Yields [(independent choice, domnb, absnb, indnb)].
- inner_prod(self, v1, v2)
- Parameters: two choice characteristic vectors
Renders the inner product of two characteristic vetors.
- intstab(self, choice)
- Computes the independence degree of a choice.
- irreflex(self, mat)
- Puts diagonal entries of mat to valuationdomain['min']
- isAsymmetricIndeterminate(self, Debug=False)
- Checks the self.relation for assymmetric indeterminateness!!
.. warning::
The reflexive links are ignored !!
- isComplete(self, Debug=False)
- checks the completeness property of self.relation by checking
for the absence of a link between two actions!!
.. warning::
The reflexive links are ignored !!
- isCyclic(self, Debug=False)
- checks the cyclicity of self.relation by checking
for a reflexive loop in its transitive closure-
.. warning::
self.relation is supposed to be irreflexive !
- isIntegerValued(self, Debug=False)
- Checks whether the decimal valuation of self is integer-valued
be using the as_integer_ratio() method of a Decimal
giving a tuple (numerator,denominator). If denominator == 1, the
number is an integer.
- isOutrankingDigraph(self, Comments=True, Debug=False)
- Checks the outranking digraph characteristic condition (3.3).
relation[x][y] + relation[y][x)[y] >= 0.0
.. warning::
The reflexive links are ignored and the valuation must be bipolar !!
- isStrictOutrankingDigraph(self, Comments=True, Debug=False)
- Checks the strict outranking digraph characteristic condition (3.1).
-(relation[x][y] + relation[y][x]) <= 0.0 , x != y
.. warning::
The reflexive links are ignored and the valuation must be bipolar !!
- isSymmetric(self, Comments=False)
- True if symmetry degree == 1.0.
- isTransitive(self, Comments=False)
- True if transitivity degree == 1.0.
- isWeaklyComplete(self, Debug=False)
- checks the weakly completeness property of self.relation by checking
for the absence of a link between two actions!!
.. warning::
The reflexive links are ignored !!
- iterateRankingByChoosing(self, Odd=False, CoDual=False, Comments=True, Debug=False, Limited=None)
- Renders a ranking by choosing result when progressively eliminating
all chordless (odd only) circuits with rising valuation cut levels.
Parameters
CoDual = False (default)/True
Limited = proportion (in [0,1]) * (max - med) valuationdomain
- kChoices(self, A, k)
- Renders all choices of length k from set A
- matmult2(self, m, v)
- Parameters: digraph relation and choice characteristic vector
matrix multiply vector by inner production
- meanDegree(self)
- Renders the mean degree of self.
!!! self.size must be set previously !!!
- meanLength(self, Oriented=False)
- Renders the (by default non-oriented) mean neighbourhoor depth of self.
!!! self.order must be set previously !!!
- minimalChoices(self, S)
- Generates all dominant or absorbent choices of a bipolar
valued digraph.
.. note:
* Initiate with S = (actions, dict of dominant or absorbent closed neighborhoods)
* See showMinDom and showMinAbs methods.
- minimalValuationLevelForCircuitsElimination(self, Odd=True, Debug=False, Comments=False)
- renders the minimal valuation level <lambda> that eliminates all
self.circuitsList stored odd chordless circuits from self.
.. warning::
The <lambda> level polarised may still contain newly appearing chordless odd circuits !
- neighbourhoodCollection(self, Oriented=False, Potential=False)
- Renders the neighbourhood.
- neighbourhoodDepthDistribution(self, Oriented=False)
- Renders the distribtion of neighbourhood depths.
- notGammaSets(self)
- Renders the dictionary of neighborhoods {node: (dx,ax)}
with set *dx* gathering the not dominated, and set *ax* gathering
the not absorbed neighborhood.
- notaneighbors(self, node)
- Renders the set of absorbed not in-neighbors of a node.
- notdneighbors(self, node)
- Renders the set of not dominated out-neighbors of a node.
- outDegrees(self)
- renders the median cut outdegrees
- outDegreesDistribution(self)
- Renders the distribution of outdegrees.
- plusirredundant(self, U)
- Generates all +irredundant choices of a digraph.
- powerset(self, U)
- Generates all subsets of a set.
- readPerrinMisset(self, file='curd.dat')
- read method for 0-1-char-coded MISs by default from the perrinMIS.c curd.dat result file.
- readabsvector(self, x, relation)
- Parameter: action x
absorbent in vector.
- readdomvector(self, x, relation)
- Parameter: action x
dominant out vector.
- relationFct(self, x, y)
- wrapper for self.relation dictionary access to ensure interoperability
with the sparse and big outranking digraph implementation model.
- save(self, fileName='tempdigraph', option=None, DecimalValuation=True, decDigits=2)
- Persistent storage of a Digraph class instance in the form of
a python source code file
- saveCSV(self, fileName='tempdigraph', Normalized=False, Dual=False, Converse=False, Diagonal=False, Debug=False)
- Persistent storage of a Digraph class instance in the form of
a csv file.
- saveXMCDA2(self, fileName='temp', fileExt='xmcda2', Comments=True, relationName='R', relationType='binary', category='random', subcategory='valued', author='digraphs Module (RB)', reference='saved from Python', valuationType='standard', digits=2, servingD3=False)
- save digraph in XMCDA 2.0 format. Deprecated now.
- savedre(self, fileName='temp')
- save digraph in nauty format.
- sharp(self, x, y)
- Paramaters: choice characteristic values.
Renders the sharpest of two characteristic values x and y.
- sharpvec(self, v, w)
- Paramaters: choice characteristic vectors.
Renders the sharpest of two characteristic vectors v and w.
- showAttributes(self)
- Prints out the attributes of self.
- showAutomorphismGenerators(self)
- Renders the generators of the automorphism group.
- showBadChoices(self, Recompute=True)
- Characteristic values for potentially bad choices.
- showChoiceVector(self, ch, choiceType='good', ChoiceVector=True)
- Show procedure for annotated bipolar choices.
- showChordlessCircuits(self, Recompute=False)
- Show method for chordless circuits observed in a Digraph instance.
If previous computation is required, stores the detected circuits in self.circuitsList attribute.
- showCorrelation(self, corr=None, ndigits=3)
- Renders the valued ordinal correlation index, the crisp Kendall tau index and their epistemic determination degree.
- showFirstChoiceRecommendation(self, Verbose=False, Comments=True, ChoiceVector=False, CoDual=True, Debug=False, _OldCoca=False, BrokenCocs=True)
- Shows the RuBis first choice recommendation.
.. note::
Computes by default the Rubis first choice recommendation on the corresponding strict (codual) outranking digraph.
By default, with BrokenCocs=True, we brake all chordless circuits at their weakest determined ( abs(r(x>y)) + abs(r(y>x)) ) link.
When BrokenCocs=False we proceed like follows:
In case of chordless circuits, if supporting arcs are more credible
than the reversed negating arcs, we collapse the circuits into hyper nodes.
Inversely, if supporting arcs are not more credible than the reversed negating arcs,
we brake the circuits on their weakest arc.
Usage example:
>>> from outrankingDigraphs import *
>>> t = Random3ObjectivesPerformanceTableau(seed=5)
>>> g = BipolarOutrankingDigraph(t)
>>> g.showFirstChoiceRecommendation()
***********************
RuBis First Choice Recommendation (BCR)
(in decreasing order of determinateness)
Credibility domain: [-100.0, 100.0]
=== >> potential first choices
* choice : ['a04', 'a14', 'a19', 'a20']
independence : 1.19
dominance : 4.76
absorbency : -59.52
covering (%) : 75.00
determinateness (%) : 57.86
- most credible action(s) = { 'a14': 23.81, 'a19': 11.90, 'a04': 2.38, 'a20': 1.19, }
=== >> potential last choices
* choice : ['a03', 'a12', 'a17']
independence : 4.76
dominance : -76.19
absorbency : 4.76
covering (%) : 0.00
determinateness (%) : 65.39
- most credible action(s) = { 'a03': 38.10, 'a12': 13.10, 'a17': 4.76, }
Execution time: 0.024 seconds
*****************************
- showGoodChoices(self, Recompute=True)
- Characteristic values for potentially good choices.
- showHTMLBestChoiceRecommendation(self, pageTitle=None, ChoiceVector=False, CoDual=True, Debug=False, _OldCoca=False, BrokenCocs=True, htmlFileName=None)
- showHTMLRelationHeatmap(self, actionsList=None, rankingRule='NetFlows', colorLevels=7, tableTitle='Relation Heatmap', relationName='r(x S y)', ndigits=2, fromIndex=None, toIndex=None, htmlFileName=None)
- Launches a browser window with the colored relation map of self.
See corresponding :py:class:`~digraphs.Digraph.showHTMLRelationMap` method.
The *colorLevels* parameter may be set to 3, 5, 7 (default) or 9.
When the *actionsList* parameter is *None* (default), the digraphs actions list may be ranked with the *rankingRule* parameter set to the 'Copeland' (default) or to the 'Netlows' ranking rule.
When the *htmlFileName* parameter is set to a string value 'xxx', a html file named 'xxx.html' will be generated in the current working directory. Otherwise, a temporary file named 'tmp*.html' will be generated there.
Example::
>>> from outrankingDigraphs import *
>>> t = RandomCBPerformanceTableau(numberOfActions=25,seed=1)
>>> g = BipolarOutrankingDigraph(t,ndigits=2)
>>> gcd = ~(-g) # strict outranking relation
>>> gcd.showHTMLRelationHeatmap(colorLevels=7,ndigits=2)
.. image:: relationHeatmap.png
:alt: Browser view of a relation map
:width: 600 px
:align: center
- showMIS(self, withListing=True)
- Prints all maximal independent choices:
Result in self.misset.
- showMIS_AH(self, withListing=True)
- Prints all MIS using the Hertz method.
Result saved in self.hertzmisset.
- showMIS_HB2(self, withListing=True)
- Prints all MIS using the Hertz-Bisdorff method.
Result saved in self.newmisset.
- showMIS_RB(self, withListing=True)
- Prints all MIS using the Bisdorff method.
Result saved in self.newmisset.
- showMIS_UD(self, withListing=True)
- Prints all MIS using the Hertz-Bisdorff method.
Result saved in self.newmisset.
- showMaxAbsIrred(self, withListing=True)
- Computing maximal -irredundant choices:
Result in self.absirset.
- showMaxDomIrred(self, withListing=True)
- Computing maximal +irredundant choices:
Result in self.domirset.
- showMinAbs(self, withListing=True)
- Prints minimal absorbent choices:
Result in self.absset.
- showMinDom(self, withListing=True)
- Prints all minimal dominant choices:
Result in self.domset.
- showNeighborhoods(self)
- Lists the gamma and the notGamma function of self.
- showOrbits(self, InChoices, withListing=True)
- Prints the orbits of Choices along the automorphisms of
the Digraph instance.
Example Python session for computing the non isomorphic MISs from the 12-cycle graph:
>>> from digraphs import *
>>> c12 = CirculantDigraph(order=12,circulants=[1,-1])
>>> c12.automorphismGenerators()
...
Permutations
{'1': '1', '2': '12', '3': '11', '4': '10', '5':
'9', '6': '8', '7': '7', '8': '6', '9': '5', '10':
'4', '11': '3', '12': '2'}
{'1': '2', '2': '1', '3': '12', '4': '11', '5': '10',
'6': '9', '7': '8', '8': '7', '9': '6', '10': '5',
'11': '4', '12': '3'}
Reflections {}
>>> print('grpsize = ', c12.automorphismGroupSize)
grpsize = 24
>>> c12.showMIS(withListing=False)
*--- Maximal independent choices ---*
number of solutions: 29
cardinality distribution
card.: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
freq.: [0, 0, 0, 0, 3, 24, 2, 0, 0, 0, 0, 0, 0]
Results in c12.misset
>>> c12.showOrbits(c12.misset,withListing=False)
...
*---- Global result ----
Number of MIS: 29
Number of orbits : 4
Labelled representatives:
1: ['2','4','6','8','10','12']
2: ['2','5','8','11']
3: ['2','4','6','9','11']
4: ['1','4','7','9','11']
Symmetry vector
stabilizer size: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ...]
frequency : [0, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, ...]
*Figure*: The symmetry axes of the non isomorphic MISs of the 12-cycle:
.. image:: c12.png
:width: 400 px
:align: center
:alt: The 4 non isomorphic MIS of the 12-cycle graph
*Reference*: R. Bisdorff and J.L. Marichal (2008). Counting non-isomorphic maximal independent sets of the n-cycle graph. *Journal of Integer Sequences*, Vol. 11 Article 08.5.7 (`openly accessible here <https://www.cs.uwaterloo.ca/journals/JIS/VOL11/Marichal/marichal.html>`_)
- showOrbitsFromFile(self, InFile, withListing=True)
- Prints the orbits of Choices along the automorphisms of
the digraph self by reading in the 0-1 misset file format.
See the :py:func:`digraphs.Digraph.readPerrinMisset` method.
- showPreKernels(self, withListing=True)
- Printing dominant and absorbent preKernels:
Result in self.dompreKernels and self.abspreKernels
- showRankingByBestChoosing(self, rankingByBestChoosing=None)
- A show method for self.rankinByBestChoosing result.
.. warning::
The self.computeRankingByBestChoosing(CoDual=False/True) method instantiating the self.rankingByBestChoosing slot is pre-required !
- showRankingByChoosing(self, rankingByChoosing=None, WithCoverCredibility=False)
- A show method for self.rankinByChoosing result.
When parameter *WithCoverCredibility* is set to True, the credibility of outranking, respectively being outranked is indicated at each selection step.
.. warning::
The self.computeRankingByChoosing(CoDual=False/True) method instantiating the self.rankingByChoosing slot is pre-required !
- showRankingByLastChoosing(self, rankingByLastChoosing=None, Debug=None)
- A show method for self.rankinByChoosing result.
.. warning::
The self.computeRankingByLastChoosing(CoDual=False/True) method instantiating the self.rankingByChoosing slot is pre-required !
- showRelation(self)
- prints the relation valuation in ##.## format.
- showRubyChoice(self, Verbose=False, Comments=True, _OldCoca=True)
- Dummy for showBestChoiceRecommendation()
needed for older versions compatibility.
- showStatistics(self)
- Computes digraph statistics like order, size and arc-density.
- showdre(self)
- Shows relation in nauty format.
- singletons(self)
- list of singletons and neighborhoods
[(singx1, +nx1, -nx1, not(+nx1 or -nx1)),.... ]
- sizeSubGraph(self, choice)
- Output: (size, undeterm,arcDensity).
Renders the arc density of the induced subgraph.
- strongComponents(self, setPotential=False)
- Renders the set of strong components of self.
- symDegreesDistribution(self)
- Renders the distribution of symmetric degrees.
- topologicalSort(self, Debug=False)
- If self is acyclic, adds topological sort number to each node of self
and renders ordered list of nodes. Otherwise renders None.
Source: M. Golumbic Algorithmic Graph heory and Perfect Graphs,
Annals Of Discrete Mathematics 57 2nd Ed. , Elsevier 2004, Algorithm 2.4 p.44.
- weakAneighbors(self, node)
- Renders the set of absorbed in-neighbors of a node.
- weakCondorcetLosers(self)
- Renders the set of decision actions x such that
self.relation[x][y] <= self.valuationdomain['med']
for all y != x.
- weakCondorcetWinners(self)
- Renders the set of decision actions x such that
self.relation[x][y] >= self.valuationdomain['med']
for all y != x.
- weakDneighbors(self, node)
- Renders the set of dominated out-neighbors of a node.
- weakGammaSets(self)
- Renders the dictionary of neighborhoods {node: (dx,ax)}
- zoomValuation(self, zoomFactor=1.0)
- Zooms in or out, depending on the value of the zoomFactor provided,
the bipolar valuation of a digraph.
Data descriptors inherited from digraphs.Digraph:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Methods inherited from perfTabs.PerformanceTableau:
- computeActionCriterionPerformanceDifferences(self, refAction, refCriterion, comments=False, Debug=False)
- computes the performances differences observed between the reference action and the others on the given criterion
- computeActionCriterionQuantile(self, action, criterion, strategy='average', Debug=False)
- renders the quantile of the performance of action on criterion
- computeActionQuantile(self, action, Debug=False)
- renders the overall performance quantile of action
- computeAllQuantiles(self, Sorted=True, Comments=False)
- renders a html string showing the table of
the quantiles matrix action x criterion
- computeCriterionPerformanceDifferences(self, c, Comments=False, Debug=False)
- Renders the ordered list of all observed performance differences on the given criterion.
- computeDefaultDiscriminationThresholds(self, criteriaList=None, quantile={'ind': 10, 'pref': 20, 'weakVeto': 60, 'veto': 80}, Debug=False, Comments=False)
- updates the discrimination thresholds with the percentiles
from the performance differences.
Parameters: quantile = {'ind': 10, 'pref': 20, 'weakVeto': 60, 'veto: 80}.
- computeMinMaxEvaluations(self, criteria=None, actions=None)
- renders minimum and maximum performances on each criterion
in dictionary form: {'g': {'minimum': x, 'maximum': x}}
- computeMissingDataProportion(self, InPercents=False, Comments=False)
- Renders the proportion of missing data,
i.e. NA == Decimal('-999') entries in self.evaluation.
- computeNormalizedDiffEvaluations(self, lowValue=0.0, highValue=100.0, withOutput=False, Debug=False)
- renders and csv stores (withOutput=True) the
list of normalized evaluation differences observed on the family of criteria
Is only adequate if all criteria have the same
evaluation scale. Therefore the performance tableau is normalized to 0.0-100.0 scales.
- computePerformanceDifferences(self, Comments=False, Debug=False, NotPermanentDiffs=True, WithMaxMin=False)
- Adds to the criteria dictionary the ordered list of all observed performance differences.
- computeQuantileOrder(self, q0=3, q1=0, Threading=False, nbrOfCPUs=None, startMethod=None, Comments=False)
- Renders a linear ordering of the decision actions from a simulation of pre-ranked outranking digraphs.
The pre-ranking simulations range by default from
quantiles=q0 to quantiles=min( 100, max(10,len(self.actions)/10]) ).
The actions are ordered along a decreasing Borda score of their ranking results.
- computeQuantilePreorder(self, Comments=True, Debug=False)
- computes the preorder of the actions obtained from decreasing majority quantiles. The quantiles are recomputed with a call to the self.computeQuantileSort() method.
- computeQuantileRanking(self, q0=3, q1=0, Threading=False, nbrOfCPUs=None, startMethod=None, Comments=False)
- Renders a linear ranking of the decision actions from a simulation of pre-ranked outranking digraphs.
The pre-ranking simulations range by default from
quantiles=q0 to qantiles=min( 100, max(10,len(self.actions)/10) ).
The actions are ordered along an increasing Borda score of their ranking results.
- computeQuantileSort(self)
- shows a sorting of the actions from decreasing majority quantiles
- computeQuantiles(self, Debug=False)
- renders a quantiles matrix action x criterion with the performance quantile of action on criterion
- computeRankingConsensusQuality(self, ranking, Comments=False, Threading=False, nbrOfCPUs=1)
- Renders the marginal criteria correlations with a given ranking with summary.
- computeThresholdPercentile(self, criterion, threshold, Debug=False)
- computes for a given criterion the quantile
of the performance differences of a given constant threshold.
- computeVariableThresholdPercentile(self, criterion, threshold, Debug=False)
- computes for a given criterion the quantile
of the performance differences of a given threshold.
- computeWeightPreorder(self)
- renders the weight preorder following from the given
criteria weights in a list of increasing equivalence
lists of criteria.
- computeWeightedAveragePerformances(self, isNormalized=False, lowValue=0.0, highValue=100.0, isListRanked=False)
- Compute normalized weighted average scores by ignoring missing data.
When *isNormalized* == True (False by default),
transforms all the scores into a common 0-100 scale.
A lowValue and highValue parameter
can be provided for a specific normalisation.
- convert2BigData(self)
- Renders a cPerformanceTableau instance, by converting the action keys to integers and evaluations to floats, including the discrimination thresholds, the case given.
- convertDiscriminationThresholds2Decimal(self)
- convertDiscriminationThresholds2Float(self)
- convertEvaluation2Decimal(self)
- Convert evaluations from obsolete float format to decimal format
- convertEvaluation2Float(self)
- Convert evaluations from decimal format to float
- convertInsite2BigData(self)
- Convert in site a standard formated Performance tableau into a bigData formated instance.
- convertInsite2Standard(self)
- Convert in site a bigData formated Performance tableau back into a standard formated PerformanceTableau instance.
- convertWeight2Decimal(self)
- Convert significance weights from obsolete float format
to decimal format.
- convertWeight2Integer(self)
- Convert significance weights from Decimal format
to int format.
- convertWeights2Negative(self)
- Negates the weights of criteria to be minimzed.
- convertWeights2Positive(self)
- Sets negative weights back to positive weights and negates corresponding evaluation grades.
- csvAllQuantiles(self, fileName='quantiles')
- save quantiles matrix criterionxaction in CSV format
- hasOddWeightAlgebra(self, Debug=False)
- Verify if the given criteria[self]['weight'] are odd or not.
Return a Boolen value.
- normalizeEvaluations(self, lowValue=0.0, highValue=100.0, Debug=False)
- recode the evaluations between lowValue and highValue on all criteria
- quantizeCriterionEvaluations(self, g, q, ndigits=2, Debug=True)
- q-tile evaluation of criterion q
- replaceNA(self, newNA=None, Comments=False)
- Replaces the current self.NA symbol with the *newNA* symbol of type <Decimal>. If newNA is None, the defauklt value Decimal('-999') is used.
- restoreOriginalEvaluations(self, lowValue=0.0, highValue=100.0, Debug=False)
- recode the evaluations to their original values on all criteria
- saveXMCDA2String(self, fileName='temp', category='XMCDA 2.0 format', user='digraphs Module (RB)', version='saved from Python session', title='Performance Tableau in XMCDA-2.0 format.', variant='Rubis', valuationType='bipolar', servingD3=True, comment='produced by stringIO()', stringNA='NA')
- save performance tableau object self in XMCDA 2.0 format.
!!! obsolete: replaced by the isStringIO in the saveXMCDA2 method !!!
- setObjectiveWeights(self, Debug=False)
- Set the objective weights to the sum of the corresponding criteria significance weights.
- showAllQuantiles(self, Sorted=True)
- prints the performance quantiles tableau in the session console.
- showEvaluationStatistics(self)
- renders the variance and standard deviation of
the values observed in the performance Tableau.
- showHTMLCriteria(self, criteriaSubset=None, Sorted=True, ndigits=2, title=None, htmlFileName=None)
- shows the criteria in the system browser view.
- showHTMLPerformanceHeatmap(self, actionsList=None, WithActionNames=False, fromIndex=None, toIndex=None, Transposed=False, criteriaList=None, colorLevels=7, pageTitle=None, ndigits=2, SparseModel=False, outrankingModel='standard', minimalComponentSize=1, rankingRule='NetFlows', StoreRanking=True, quantiles=None, strategy='average', Correlations=False, htmlFileName=None, Threading=False, startMethod=None, nbrOfCPUs=None, Debug=False)
- shows the html heatmap version of the performance tableau in a browser window
(see perfTabs.htmlPerformanceHeatMap() method ).
**Parameters**:
* *actionsList* and *criteriaList*, if provided, give the possibility to show
the decision alternatives, resp. criteria, in a given ordering.
* *WithActionNames* = True (default False) will show the action names instead of the short names or the identifyers.
* *ndigits* = 0 may be used to show integer evaluation values.
* *colorLevels* may be 3, 5, 7, or 9.
* When no *actionsList* is provided, the decision actions are ordered from the best to the worst. This
ranking is obtained by default with the Copeland rule applied on a standard *BipolarOutrankingDigraph*.
* When the *SparseModel* flag is put to *True*, a sparse *PreRankedOutrankingDigraph* construction is used instead.
* the *outrankingModel* parameter (default = 'standard') allows to switch to alternative BipolarOutrankingDigraph constructors, like 'confident' or 'robust' models. When called from a bipolar-valued outrankingDigraph instance, *outrankingModel* = 'this' keeps the current outranking model without recomputing by default the standard outranking model.
* The *minimalComponentSize* allows to control the fill rate of the pre-ranked model.
When *minimalComponentSize* = *n* (the number of decision actions) both the pre-ranked model will be
in fact equivalent to the standard model.
* *rankingRule* = 'NetFlows' (default) | 'Copeland' | 'Kohler' | 'RankedPairs' | 'ArrowRaymond'
| 'IteratedNetFlows' | 'IteraredCopeland'. See tutorial on ranking mith multiple incommensurable criteria.
* when the *StoreRanking* flag is set to *True*, the ranking result is storted in *self*.
* Quantiles used for the pre-ranked decomposition are put by default to *n*
(the number of decision alternatives) for *n* < 50. For larger cardinalities up to 1000, quantiles = *n* /10.
For bigger performance tableaux the *quantiles* parameter may be set to a much lower value
not exceeding usually 10.
* The pre-ranking may be obtained with three ordering strategies for the
quantiles equivalence classes: 'average' (default), 'optimistic' or 'pessimistic'.
* With *Correlations* = *True* and *criteriaList* = *None*, the criteria will be presented from left to right in decreasing
order of the correlations between the marginal criterion based ranking and the global ranking used for
presenting the decision alternatives.
* For large performance Tableaux, *multiprocessing* techniques may be used by setting
*Threading* = *True* in order to speed up the computations; especially when *Correlations* = *True*.
* By default, the number of cores available, will be detected. It may be necessary in a HPC context to indicate the exact number of singled threaded cores in fact allocated to the multiprocessing job.
>>> from randomPerfTabs import RandomPerformanceTableau
>>> rt = RandomPerformanceTableau(seed=100)
>>> rt.showHTMLPerformanceHeatmap(colorLevels=5,Correlations=True)
.. image:: perfTabsExample.png
:alt: HTML heat map of the performance tableau
:width: 600 px
:align: center
- showHTMLPerformanceQuantiles(self, Sorted=True, htmlFileName=None)
- shows the performance quantiles tableau in a browser window.
- showHTMLPerformanceTableau(self, actionsSubset=None, fromIndex=None, toIndex=None, isSorted=False, Transposed=False, ndigits=2, ContentCentered=True, title=None, htmlFileName=None)
- shows the html version of the performance tableau in a browser window.
- showObjectives(self)
- showQuantileSort(self, Debug=False)
- Wrapper of computeQuantilePreorder() for the obsolete showQuantileSort() method.
- showRankingConsensusQuality(self, ranking)
- shows the marginal criteria correlations with a given ranking with summary.
- showWeightPreorder(self)
- Renders a preordering of the the criteria signficance weights.
|
class SparseOutrankingDigraph(outrankingDigraphs.BipolarOutrankingDigraph) |
| |
Abstract root class for linearly decomposed sparse digraphs. |
| |
- Method resolution order:
- SparseOutrankingDigraph
- outrankingDigraphs.BipolarOutrankingDigraph
- outrankingDigraphs.OutrankingDigraph
- digraphs.Digraph
- perfTabs.PerformanceTableau
- builtins.object
Methods defined here:
- __init__()
- Initialize self. See help(type(self)) for accurate signature.
- __repr__(self)
- Default presentation method for pre-ranked sparse digraphs instances.
- computeDecompositionSummaryStatistics(self)
- Returns the summary of the distribution of the length of
the components as follows::
summary = {'max': maxLength,
'median':medianLength,
'mean':meanLength,
'stdev': stdLength,
'fillrate': fillrate,
(see computeFillRate()}
- computeDeterminateness(self)
- Computes the Kendalll distance in % of self
with the all median valued (indeterminate) digraph.
- computeFillRate(self)
- Renders the sum of the squares (without diagonal) of the orders of the component's subgraphs
over the square (without diagonal) of the big digraph order.
- computeOrderCorrelation(self, order, Debug=False)
- Renders the ordinal correlation K of a sparse digraph instance
when compared with a given linear order (from worst to best) of its actions
K = sum_{x != y} [ min( max(-self.relation(x,y)),other.relation(x,y), max(self.relation(x,y),-other.relation(x,y)) ]
K /= sum_{x!=y} [ min(abs(self.relation(x,y),abs(other.relation(x,y)) ]
.. note::
Renders a dictionary with the key 'correlation' containing the actual bipolar correlation index and the key 'determination' containing the minimal determination level D of self and the other relation.
D = sum_{x != y} min(abs(self.relation(x,y)),abs(other.relation(x,y)) / n(n-1)
where n is the number of actions considered.
The correlation index with a completely indeterminate relation
is by convention 0.0 at determination level 0.0 .
.. warning::
self must be a normalized outranking digraph instance !
- computeOrdinalCorrelation(self, other, Debug=False)
- Renders the ordinal correlation K of a SpareOutrakingDigraph instance
when compared with a given compatible (same actions set) other Digraph instance.
K = sum_{x != y} [ min( max(-self.relation(x,y)),other.relation(x,y), max(self.relation(x,y),-other.relation(x,y)) ]
K /= sum_{x!=y} [ min(abs(self.relation(x,y),abs(other.relation(x,y)) ]
.. note::
The global outranking relation of SparesOutrankingDigraph instances is contructed on the fly
from the ordered dictionary of the components.
Renders a dictionary with a 'correlation' key containing the actual bipolar correlation index K and a 'determination' key containing the minimal determination level D of self and the other relation, where
D = sum_{x != y} min(abs(self.relation(x,y)),abs(other.relation(x,y)) / n(n-1)
and where n is the number of actions considered.
The correlation index K with a completely indeterminate relation
is by convention 0.0 at determination level 0.0 .
- estimateRankingCorrelation(self, sampleSize=100, seed=1, Debug=False)
- exportGraphViz(self, fileName=None, actionsSubset=None, direction='decreasing', Comments=True, graphType='pdf', graphSize='7,7', fontSize=10, bgcolor='cornsilk', relation=None, Debug=False)
- Dummy for exportSortingDigraph.
- exportSortingGraphViz(self, fileName=None, actionsSubset=None, direction='decreasing', Comments=True, graphType='pdf', graphSize='7,7', fontSize=10, bgcolor='cornsilk', relation=None, Debug=False)
- export GraphViz dot file for weak order (Hasse diagram) drawing
filtering from SortingDigraph instances.
Example::
>>> # Testing graph viz export of sorting Hasse diagram
>>> MP = True
>>> nbrActions=100
>>> tp = RandomCBPerformanceTableau(numberOfActions=nbrActions,
... Threading=MP,
... seed=100)
>>> bg = PreRankedOutrankingDigraph(tp,CopyPerfTab=True,quantiles=20,
... quantilesOrderingStrategy='average',
... componentRankingRule='Copeland',
... LowerClosed=False,
... minimalComponentSize=1,
... Threading=MP,nbrOfCPUs=8,
... #tempDir='.',
... nbrOfThreads=8,
... Comments=False,Debug=False)
>>> print(bg)
*----- show short --------------*
Instance name : randomCBperftab_mp
# Actions : 100
# Criteria : 7
Sorting by : 20-Tiling
Ordering strategy : average
Ranking rule : Copeland
# Components : 36
Minimal order : 1
Maximal order : 11
Average order : 2.8
fill rate : 4.121%
---- Constructor run times (in sec.) ----
Total time : 0.15991
QuantilesSorting : 0.11717
Preordering : 0.00066
Decomposing : 0.04009
Ordering : 0.00000
>>> bg.showComponents()
*--- Relation decomposition in increasing order---*
35: ['a010']
34: ['a024', 'a060']
33: ['a012']
32: ['a018']
31: ['a004', 'a054', 'a075', 'a082']
30: ['a099']
29: ['a065']
28: ['a025', 'a027', 'a029', 'a041', 'a059']
27: ['a063']
26: ['a047', 'a066']
25: ['a021']
24: ['a007']
23: ['a044']
22: ['a037', 'a062', 'a090', 'a094', 'a098', 'a100']
21: ['a005', 'a040', 'a051', 'a093']
20: ['a015', 'a030', 'a052', 'a055', 'a064', 'a077']
19: ['a006', 'a061']
18: ['a049']
17: ['a001', 'a033']
16: ['a016', 'a028', 'a032', 'a035', 'a057', 'a079', 'a084', 'a095']
15: ['a043']
14: ['a002', 'a017', 'a023', 'a034', 'a067', 'a072', 'a073', 'a074', 'a088', 'a089', 'a097']
13: ['a048']
12: ['a078', 'a092']
11: ['a070']
10: ['a014', 'a026', 'a039', 'a058', 'a068', 'a083', 'a086']
9: ['a008', 'a022', 'a038', 'a081', 'a091', 'a096']
8: ['a020']
7: ['a069']
6: ['a045']
5: ['a003', 'a009', 'a013', 'a031', 'a036', 'a056', 'a076']
4: ['a042', 'a071']
3: ['a085']
2: ['a019', 'a080', 'a087']
1: ['a046']
0: ['a011', 'a050', 'a053']
>>> bg.exportSortingGraphViz(actionsSubset=bg.boostedRanking[:100])
.. image:: preRankedDigraph.png
:alt: pre-ranked digraph
:width: 400 px
:align: center
- htmlRelationMap(self, actionsSubset=None, tableTitle='Relation Map', relationName='r(x R y)', symbols=['+', '·', ' ', '-', '_'], Colored=True, ContentCentered=True)
- renders the relation map in actions X actions html table format.
- ordering2Preorder(self, ordering)
- Renders a preordering (a list of list) of a linar order (worst to best) of decision actions in increasing preference direction.
- ranking2Preorder(self, ranking)
- Renders a preordering (a list of list) of a ranking (best to worst) of decision actions in increasing preference direction.
- recodeValuation(self, newMin=-1, newMax=1, Debug=False)
- Specialization for recoding the valuation of all the partial digraphs and the component relation.
By default the valuation domain is normalized to [-1;1]
- relation(self, x, y, Debug=False)
- Dynamic construction of the global outranking characteristic function *r(x S y)*.
- showBestChoiceRecommendation(self, Comments=False, ChoiceVector=False, Debug=False)
- *Parameters*:
* Comments=False,
* ChoiceVector=False,
* Debug=False.
Update of rubisBestChoice Recommendation for big digraphs.
To do: limit to best choice; worst choice should be a separate method()
- showDecomposition(self, direction='decreasing')
- Prints on the console the decomposition structure of the sparse outranking digraph instance
in *decreasing* (default) or *increasing* preference direction.
- showHTMLMarginalQuantileLimits(self, htmlFileName=None)
- shows the marginal quantiles limits.
- showHTMLRelationMap(self, actionsSubset=None, Colored=True, tableTitle='Relation Map', relationName='r(x S y)', symbols=['+', '·', ' ', '–', '—'], htmlFileName=None)
- Launches a browser window with the colored relation map of self.
- showHTMLRelationTable(self, actionsList=None, IntegerValues=False, ndigits=2, Colored=True, tableTitle='Valued Sparse Relation Table', relationName='r(x,y)', ReflexiveTerms=False, fromIndex=None, toIndex=None, htmlFileName=None)
- Launches a browser window with the colored relation table of self.
- showRelationMap(self, fromIndex=None, toIndex=None, symbols=None, actionsList=None)
- Prints on the console, in text map format, the location of
the diagonal outranking components of the sparse outranking digraph.
By default, symbols = {'max':'┬','positive': '+', 'median': ' ',
'negative': '-', 'min': '┴'}
Example::
>>> from sparseOutrankingDigraphs import *
>>> t = RandomCBPerformanceTableau(numberOfActions=50,seed=1)
>>> bg = PreRankedOutrankingDigraph(t,quantiles=10,minimalComponentSize=5)
>>> print(bg)
*----- show short --------------*
Instance name : randomCBperftab_mp
# Actions : 50
# Criteria : 7
Sorting by : 10-Tiling
Ordering strategy : average
Ranking Rule : Copeland
# Components : 7
Minimal size : 5
Maximal size : 13
Median size : 6
fill rate : 16.898%
---- Constructor run times (in sec.) ----
Total time : 0.08494
QuantilesSorting : 0.04339
Preordering : 0.00034
Decomposing : 0.03989
Ordering : 0.00024
>>> bg.showRelationMap()
┬+++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴ ++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
+ ++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
--- -┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
-┴-+ ┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴ ┬-+┬+┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴ +┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴+ + ┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴-+- ++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴ + ┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴ - ┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴ +++-+++++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴+ +++++++++-+┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴+- +--+++++++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴--+ -++++++-+┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴++++ +- ++ ┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴--+-+ +++++++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴-+-++- ++++--┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴-++-++- + -+-┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴---- ++- + ++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴-+--++++- -++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴--- --+++ ++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴+-+-++-+-+ +┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴-+- -+++-++ ┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ - + + ┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ -+ + ++┬++┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴++ +++++++++┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ -- -+-++ ┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴++++ ++++++-┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴----- ++-┬+┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ +++- -++-+┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴-----++ -++┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ +-+-+-+ -++┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴+ +++ ┬+┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴-- --+++ -┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴--┴+ -┴--+ ┬┬┬┬┬┬┬┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ +++++++┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴+ +++-+┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴-- +++┬┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴-- ++┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴+-+ +++┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ +- + --┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴---+++ +┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴- ┴-+++ ┬┬┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ ┬┬┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ ++ ┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ - -┬┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ -+ ┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴ ┴ ┬
┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴
Component ranking rule: Copeland
>>>
- showRubisBestChoiceRecommendation(self, Comments=False, ChoiceVector=False, Debug=False)
- Dummy for self.showBestChoiceRecommendation() method.
- sortingRelation(self, x, y, Debug=False)
- Dynamic construction of the quantiles sorting characteristic function *r(x QS y)*.
Methods inherited from outrankingDigraphs.BipolarOutrankingDigraph:
- computeCriterionRelation(self, c, a, b, hasSymmetricThresholds=True)
- Compute the outranking characteristic for actions x and y
on criterion c.
- computeSingleCriteriaNetflows(self)
- renders the Promethee single criteria netflows matrix M
- criterionCharacteristicFunction(self, c, a, b, hasSymmetricThresholds=True)
- Renders the characteristic value of the comparison of a and b on criterion c.
- saveSingleCriterionNetflows(self, fileName='tempnetflows.prn', delimiter=' ', Comments=True)
- Delimited save of single criteria netflows matrix
Methods inherited from outrankingDigraphs.OutrankingDigraph:
- computeAMPLData(self, OldValuation=False)
- renders the ampl data list
- computeActionsComparisonCorrelations(self)
- renders the comparison correlations between the actions
- computeActionsCorrelationDigraph(self)
- renders the pairwise actions comparison digraph
- computeCriteriaComparisonCorrelations(self)
- renders the comparison correlations between the criteria
- computeCriteriaCorrelationDigraph(self, ValuedCorrelation=True, WithMedian=False)
- renders the ordinal criteria correlation digraph.
- computeCriteriaCorrelations(self, ValuedCorrelation=False)
- renders the relation equivalence or correlation between the criteria
- computeCriterionCorrelation(self, criterion, Threading=False, nbrOfCPUs=None, Debug=False, Comments=False)
- Renders the ordinal correlation coefficient between
the global outranking and the marginal criterion relation.
Uses the digraphs.computeOrdinalCorrelationMP().
.. note::
Renders a dictionary with the key 'correlation' containing the actual bipolar correlation index and the key 'determination' containing the minimal determination level D of the self outranking and the marginal criterion relation.
D = sum_{x != y} min(abs(self.relation(x,y)),abs(marginalCriterionRelation(x,y)) / n(n-1)
where n is the number of actions considered.
The correlation index with a completely indeterminate relation
is by convention 0.0 at determination level 0.0 .
- computeMarginalCorrelation(self, args, Threading=False, nbrOfCPUs=None, Debug=False, Comments=False)
- Renders the ordinal correlation coefficient between
the marginal criterion relation and a
given normalized outranking relation.
args = (criterion,relation)
- computeMarginalObjectiveCorrelation(self, args, Threading=False, nbrOfCPUs=None, Debug=False, Comments=False)
- Renders the ordinal correlation coefficient between
the marginal criterion relation and a
given normalized outranking relation.
args = (objective,relation)
- computeMarginalObjectivesVersusGlobalRankingCorrelations(self, ranking, Sorted=True, ValuedCorrelation=False, Threading=False, nbrCores=None, startMethod=None, Comments=False)
- Method for computing correlations between each individual objective's outranking relation and the given global ranking relation.
Returns a list of tuples (correlation,objectiveKey) sorted by default in decreasing order of the correlation.
If Threading is True, a multiprocessing Pool class is used with a parallel equivalent of the built-in map function.
If nbrCores is not set, the os.cpu_count() function is used to determine the number of available cores.
*Usage example*:
>>> from outrankingDigraphs import *
>>> t = Random3ObjectivesPerformanceTableau(
numberOfActions=21,
numberOfCriteria=17,
vetoProbability=0.2,
seed=12)
>>> g = BipolarOutrankingDigraph(t)
>>> ranking = g.computeNetFlowsRanking()
>>> g.computeMarginalObjectivesVersusGlobalRankingCorrelations(
ranking,Threading=False,Comments=True)
Marginal objective ordinal correlation with given ranking
-------------------------------------------------
Given ranking: ['p04', 'p09', 'p01', 'p08', 'p16', 'p03',
'p13', 'p20', 'p15', 'p10', 'p18', 'p19',
'p06', 'p02', 'p07', 'p11', 'p05', 'p12',
'p14', 'p21', 'p17']
Objective (weight): correlation
Soc (135.00): +0.473
Eco (135.00): +0.457
Env (135.00): +0.326
- computeMarginalVersusGlobalOutrankingCorrelations(self, Sorted=True, ValuedCorrelation=False, Threading=False, nbrCores=None, startMethod=None, Comments=False)
- Method for computing correlations between each individual criterion relation with the corresponding
global outranking relation.
Returns a list of tuples (correlation,criterionKey) sorted by default in decreasing order of the correlation.
If Threading is True, a multiprocessing Pool class is used with a parallel equivalent of the built-in map function.
If nbrCores is not set, the os.cpu_count() function is used to determine the number of
available cores.
- computeMarginalVersusGlobalRankingCorrelations(self, ranking, Sorted=True, ValuedCorrelation=False, Threading=False, nbrCores=None, startMethod=None, Comments=False)
- Method for computing correlations between each individual criterion relation with the corresponding global ranking relation.
Returns a list of tuples (correlation,criterionKey) sorted by default in decreasing order of the correlation.
If Threading is True, a multiprocessing Pool class is used with a parallel equivalent of the built-in map function.
If nbrCores is not set, the os.cpu_count() function is used to determine the number ofavailable cores.
- computeOutrankingConsensusQuality(self, Sorted=True, ValuedCorrelation=True, Threading=False, nbrCores=None, Comments=False)
- Renders the marginal criteria correlations with the corresponding global outranking relation with summary.
- computePairwiseComparisons(self, hasSymmetricThresholds=True)
- renders pairwise comparison parameters for all pairs of actions
- computePairwiseCompleteComparison(self, a, b, c)
- renders pairwise complete comparison parameters for actions a and b
on criterion c.
- computePairwiseOddsMatrix(self)
- renders a double dictionary with odds:
(positive chaacteristics, negative characteristics)
per actions pair.
- computeQuantileSortRelation(self, Debug=False)
- Renders the bipolar-valued relation obtained from
the self quantile sorting result.
- computeSingletonRanking(self, Comments=False, Debug=False)
- Renders the sorted bipolar net determinatation of outrankingness
minus outrankedness credibilities of all singleton choices.
res = ((netdet,singleton,dom,absorb)+)
- computeVetoesStatistics(self, level=None)
- renders the cut level vetos in dictionary format:
vetos = {'all': n0, 'strong: n1, 'weak':n2}.
- computeVetosShort(self)
- renders the number of vetoes and real vetoes in an OutrankingDigraph.
- computeWeightsConcentrationIndex(self)
- Renders the Gini concentration index of the weight distribution
Based on the triangle summation formula.
- defaultDiscriminationThresholds(self, quantile={'ind': 10, 'pref': 20, 'weakVeto': 60, 'veto': 80}, Debug=False, comments=False)
- updates the discrimination thresholds with the percentiles
from the performance differences.
Parameters:
quantile = {'ind': 10, 'pref': 20, 'weakVeto': 60, 'veto: 80}.
- export3DplotOfActionsCorrelation(self, plotFileName='actCorr', graphType=None, pictureFormat='pdf', bgcolor='cornsilk', Comments=False)
- Using R for producing a plot -pdf format by default- of the principal components of
the actions ordinal correlation table.
See export3DplotCriteriaCorrelation()
- export3DplotOfCriteriaCorrelation(self, plotFileName='critCorr', tempDir='.', graphType=None, pictureFormat='pdf', bgcolor='cornsilk', ValuedCorrelation=False, WithMedian=False, Comments=False)
- Using R for producing a plot (pdf format by default) of the principal components of
the criteria ordinal correlation table.
*Parameters*:
* *plotFileName* := name of the created R plot image,
* *pictureFormat* := 'png' (default) | 'pdf' | 'jpeg' | 'xfig',
* *graphType* := deprecated
* *bgcolor* := 'cornsilk' by default | None,
* *ValuedCorrelation* := False (tau by default) | True (r(<=>) otherwise,
* *WithMedian* includes the marginal correlation with the global outranking relation
* *tempDir* := '.' : default current working directory.
- saveActionsCorrelationTable(self, fileName='tempcorr.prn', delimiter=' ', Bipolar=True, Silent=False, Centered=False)
- Delimited save of correlation table
- saveCriteriaCorrelationTable(self, fileName='tempcorr.prn', delimiter=' ', ValuedCorrelation=False, Bipolar=True, Silent=False, Centered=False)
- Delimited save of correlation table
- saveXMCDA2RubisChoiceRecommendation(self, fileName='temp', category='Rubis', subcategory='Choice Recommendation', author='digraphs Module (RB)', reference='saved from Python', comment=True, servingD3=False, relationName='Stilde', graphValuationType='bipolar', variant='standard', instanceID='void', stringNA='NA', _OldCoca=True, Debug=False)
- save complete Rubis problem and result in XMCDA 2.0 format with unicode encoding.
*Warning*: obsolete now!
- showAll(self)
- specialize the general showAll method with criteria
and performance tableau output
- showConsiderablePerformancesPolarisation(self)
- prints all considerable performance polarisations.
- showCriteriaCorrelationTable(self, ValuedCorrelation=False, isReturningHTML=False, ndigits=3)
- prints the ordinal correlation index tau between criteria in table format.
- showCriteriaHierarchy(self)
- shows the Rubis clustering of the ordinal criteria correlation table
- showCriterionRelationTable(self, criterion, actionsSubset=None)
- prints the relation valuation in actions X actions table format.
- showHTMLPairwiseComparison(self, a, b, htmlFileName=None)
- Exporting the pairwise comparison table of actions a and b in the default system browser. A specific file name may be provided.
- showHTMLPairwiseOutrankings(self, a, b, htmlFileName=None)
- Exporting the pairwise outrankings table of actions a and b
in the default system browser. A specific file name may be provided.
- showMarginalObjectivesVersusGlobalRankingCorrelations(self, ranking, Sorted=True, ValuedCorrelation=False, Threading=False, nbrCores=None)
- Corresponding compute method with Comments = True flag.
- showMarginalVersusGlobalOutrankingCorrelation(self, Sorted=True, ValuedCorrelation=False, Threading=False, nbrOfCPUs=None, Comments=True)
- Show method for computeCriterionCorrelation results.
- showOldPairwiseComparison(self, a, b, Debug=False, isReturningHTML=False, hasSymmetricThresholds=True)
- Obsolete: Renders the pairwise comprison parameters on all criteria
with weak preference and weak veto thresholds.
- showOutrankingConsensusQuality(self, Sorted=True, ValuedCorrelation=True, Threading=False, nbrCores=None, Comments=True)
- Show method for the computeOutrankingConsensusQuality() method.
- showPairwiseComparison(self, a, b, Debug=False, isReturningHTML=False, hasSymmetricThresholds=True)
- Renders the pairwise comprison parameters on all criteria
in html format
- showPairwiseComparisonsDistributions(self)
- Renders the lt,leq, eq, geq, gt distributions for all pairs
- showPairwiseOutrankings(self, a, b, Debug=False, isReturningHTML=False, hasSymmetricThresholds=True)
- Renders the pairwise outrankings table for actions *a* and *b*.
- showPerformanceTableau(self, actionsSubset=None)
- Print the performance Tableau.
- showPolarisations(self, cutLevel=None, realVetosOnly=False)
- prints all negative and positive polarised situations observed in the OutrankingDigraph instance.
- showRelationTable(self, IntegerValues=False, actionsSubset=None, rankingRule=None, Sorted=False, hasLPDDenotation=False, OddsDenotation=False, StabilityDenotation=False, hasLatexFormat=False, hasIntegerValuation=False, relation=None, ReflexiveTerms=True, fromIndex=None, toIndex=None)
- Prints the relation valuation in actions X actions table format.
Copeland and NetFlows ranking rule may be applied.
- showShort(self)
- specialize the general showShort method with the criteria.
- showSingletonRanking(self, Comments=True, Debug=False)
- Calls self.computeSingletonRanking(comments=True,Debug = False).
Renders and prints the sorted bipolar net determinatation of outrankingness
minus outrankedness credibilities of all singleton choices.
res = ((netdet,sigleton,dom,absorb)+)
- showVetos(self, cutLevel=None, realVetosOnly=False)
- prints all veto and counter-veto situations observed in the OutrankingDigraph instance.
Methods inherited from digraphs.Digraph:
- MISgen(self, S, I)
- generator of maximal independent choices (voir Byskov 2004):
* S ::= remaining nodes;
* I ::= current independent choice
.. note::
Inititalize: self.MISgen(self.actions.copy(),set())
- __invert__(self)
- Make the inverting operator ~self available for Digraph instances.
Returns a ConverseDigraph instance of self.
- __neg__(self)
- Make the negation operator -self available for Digraph instances.
Returns a DualDigraph instance of self.
- absirred(self, choice)
- Renders the crips -irredundance degree of a choice.
- absirredundant(self, U)
- Generates all -irredundant choices of a digraph.
- absirredval(self, choice, relation)
- Renders the valued -irredundance degree of a choice.
- absirredx(self, choice, x)
- Computes the crips -irredundance degree of node x in a choice.
- abskernelrestrict(self, prekernel)
- Parameter: prekernel
Renders absorbent prekernel restricted relation.
- absorb(self, choice)
- Renders the absorbency degree of a choice.
- absorbentChoices(self, S)
- Generates all minimal absorbent choices of a bipolar valued digraph.
- addValuationAttribute(self)
- Adds the numpy valuation attribute
- agglomerationDistribution(self)
- Output: aggloCoeffDistribution, meanCoeff
Renders the distribution of agglomeration coefficients.
- aneighbors(self, node)
- Renders the set of absorbed in-neighbors of a node.
- automorphismGenerators(self)
- Adds automorphism group generators to the digraph instance.
.. note::
Dependency: Uses the dreadnaut command from the nauty software package. See https://www3.cs.stonybrook.edu/~algorith/implement/nauty/implement.shtml
On Ubuntu Linux:
...$ sudo apt-get install nauty
- averageCoveringIndex(self, choice, direction='out')
- Renders the average covering index of a given choice in a set of objects,
ie the average number of choice members that cover each
non selected object.
- bipolarKCorrelation(self, digraph, Debug=False)
- Renders the bipolar Kendall correlation between two bipolar valued
digraphs computed from the average valuation of the
XORDigraph(self,digraph) instance.
.. warning::
Obsolete! Is replaced by the self.computeBipolarCorrelation(other) Digraph method
- bipolarKDistance(self, digraph, Debug=False)
- Renders the bipolar crisp Kendall distance between two bipolar valued
digraphs.
.. warning::
Obsolete! Is replaced by the self.computeBipolarCorrelation(other, MedianCut=True) Digraph method
- chordlessPaths(self, Pk, n2, Odd=False, Comments=False, Debug=False)
- New procedure from Agrum study April 2009
recursive chordless path extraction starting from path
Pk = [n2, ...., n1] and ending in node n2.
Optimized with marking of visited chordless P1s.
- circuitAverageCredibility(self, circ)
- Renders the average linking credibility of a Chordless Circuit.
- circuitCredibilities(self, circuit, Debug=False)
- Renders the average linking credibilities and the minimal link of a Chordless Circuit.
- circuitMaxCredibility(self, circ)
- Renders the maximal linking credibility of a Chordless Circuit.
- circuitMinCredibility(self, circ)
- Renders the minimal linking credibility of a Chordless Circuit.
- closeSymmetric(self, InSite=True)
- Produces the symmetric closure of self.relation.
- closeTransitive(self, Reverse=False, InSite=True, Comments=False)
- Produces the transitive closure of self.relation.
*Parameters*:
- If *Reverse* == True (False default) all transitive links are dropped, otherwise all transitive links are closed with min[r(x,y),r(y,z)];
- If *Insite* == False (True by default) the methods return a modified copy of self.relation without altering the original self.relation, otherwise self.relation is modified.
- components(self)
- Renders the list of connected components.
- computeAllDensities(self, choice=None)
- parameter: choice in self
renders six densitiy parameters:
arc density, double arc density,
single arc density, strict single arc density,
absence arc density, strict absence arc densitiy.
- computeArrowRaynaudOrder(self)
- Renders a linear ordering from worst to best of the actions following Arrow&Raynaud's rule.
- computeArrowRaynaudRanking(self)
- renders a linear ranking from best to worst of the actions following Arrow&Raynaud's rule.
- computeAverageValuation(self)
- Computes the bipolar average correlation between
self and the crisp complete digraph of same order
of the irreflexive and determined arcs of the digraph
- computeBadChoices(self, Comments=False)
- Computes characteristic values for potentially bad choices.
.. note::
Returns a tuple with following content:
[(0)-determ,(1)degirred,(2)degi,(3)degd,(4)dega,(5)str(choice),(6)absvec]
- computeBadPirlotChoices(self, Comments=False)
- Characteristic values for potentially bad choices
using the Pirlot's fixpoint algorithm.
- computeBestChoiceRecommendation(self, Verbose=False, Comments=False, ChoiceVector=False, CoDual=True, Debug=False, _OldCoca=False, BrokenCocs=True)
- Sets self.bestChoice, self.bestChoiceData, self.worstChoice and self.worstChoiceData
with the showBestChoiceRecommendation method.
First and last choices data is the following:
[(0)-determ,(1)degirred,(2)degi,(3)degd,(4)dega,(5)str(choice),(6)domvec,(7)cover]
self.bestChoice = self.bestChoiceData[5]
self.worstChoice = self.worstChoiceData[5]
- computeBipolarCorrelation(self, other, MedianCut=False, filterRelation=None, Debug=False)
- obsolete: dummy replacement for Digraph.computeOrdinalCorrelation method
- computeChordlessCircuits(self, Odd=False, Comments=False, Debug=False)
- Renders the set of all chordless circuits detected in a digraph.
Result is stored in <self.circuitsList>
holding a possibly empty list of tuples with at position 0 the
list of adjacent actions of the circuit and at position 1
the set of actions in the stored circuit.
When *Odd* is True, only chordless circuits with an odd length
are collected.
- computeChordlessCircuitsMP(self, Odd=False, Threading=False, nbrOfCPUs=None, startMethod=None, Comments=False, Debug=False)
- Multiprocessing version of computeChordlessCircuits().
Renders the set of all chordless odd circuits detected in a digraph.
Result (possible empty list) stored in <self.circuitsList>
holding a possibly empty list tuples with at position 0 the
list of adjacent actions of the circuit and at position 1
the set of actions in the stored circuit.
Inspired by Dias, Castonguay, Longo, Jradi, Algorithmica (2015).
Returns a possibly empty list of tuples (circuit,frozenset(circuit)).
If Odd == True, only circuits of odd length are retained in the result.
- computeCoSize(self)
- Renders the number of non validated non reflexive arcs
- computeConcentrationIndex(self, X, N)
- Renders the Gini concentration index of the X serie.
N contains the partial frequencies.
Based on the triangle summation formula.
- computeConcentrationIndexTrapez(self, X, N)
- Renders the Gini concentration index of the X serie.
N contains the partial frequencies.
Based on the triangles summation formula.
- computeCondorcetLosers(self)
- Wrapper for condorcetLosers().
- computeCondorcetWinners(self)
- Wrapper for condorcetWinners().
- computeCopelandOrder(self)
- renders a linear ordering from worst to best of the actions following Arrow&Raynaud's rule.
- computeCopelandRanking(self)
- renders a linear ranking from best to worst of the actions following Arrow&Raynaud's rule.
- computeCutLevelDensities(self, choice, level)
- parameter: choice in self, robustness level
renders three robust densitiy parameters:
robust double arc density,
robust single arc density,
robust absence arc densitiy.
- computeDensities(self, choice)
- parameter: choice in self
renders the four densitiy parameters:
arc density, double arc density, single arc density, absence arc density.
- computeDiameter(self, Oriented=True)
- Renders the (by default oriented) diameter of the digraph instance
- computeDigraphCentres(self, WeakDistances=False, Comments=False)
- The centers of a digraph are the nodes with finite minimal shortes path lengths.
The maximal neighborhood distances are stored in *self.maximalNeighborhoodDistances*.
The corresponding digraph radius and diameter are stored respectively in *self.radius* and *self.diameter*.
With *Comments* = True, all these results are printed out.
*Source*: Claude Berge, *The Theory of Graphs*, Dover (2001) pp. 119, original in French Dunod (1958)
- computeDynamicProgrammingStages(self, source, sink, Debug=False)
- Renders the discrete stages of the optimal substructure for
dynamic pogramming digrahs from a given source node
to a given sink sink node.
Returns a list of list of action identifyers.
- computeGoodChoiceVector(self, ker, Comments=False)
- | Computing Characteristic values for dominant pre-kernels
| using the von Neumann dual fixoint equation
- computeGoodChoices(self, Comments=False)
- Computes characteristic values for potentially good choices.
..note::
Return a tuple with following content:
[(0)-determ,(1)degirred,(2)degi,(3)degd,(4)dega,(5)str(choice),(6)domvec,(7)cover]
- computeGoodPirlotChoices(self, Comments=False)
- Characteristic values for potentially good choices
using the Pirlot fixpoint algorithm.
- computeIncomparabilityDegree(self, InPercents=False, Comments=False)
- Renders the incomparability degree (Decimal), i.e. the relative number of symmetric indeterminate relations of the irreflexive part of a digraph.
- computeKemenyIndex(self, otherRelation)
- renders the Kemeny index of the self.relation
compared with a given crisp valued relation of a compatible
other digraph (same nodes or actions).
- computeKemenyOrder(self, orderLimit=7, Debug=False)
- Renders a ordering from worst to best of the actions with maximal Kemeny index.
Return a tuple: kemenyOrder (from worst to best), kemenyIndex
- computeKemenyRanking(self, orderLimit=7, seed=None, sampleSize=1000, Debug=False)
- Renders a ranking from best to worst of the actions with maximal Kemeny index.
.. note::
Returns a tuple: kemenyRanking (from best to worst), kemenyIndex.
- computeKernelVector(self, kernel, Initial=True, Comments=False)
- | Computing Characteristic values for dominant pre-kernels
| using the von Neumann dual fixpoint equation
- computeKohlerOrder(self)
- Renders an ordering (worst to best) of the actions following Kohler's rule.
- computeKohlerRanking(self)
- Renders a ranking (best to worst) of the actions following Kohler's rule.
- computeMaxHoleSize(self, Comments=False)
- Renders the length of the largest chordless cycle
in the corresponding disjunctive undirected graph.
- computeMeanInDegree(self)
- Renders the mean indegree of self.
!!! self.size must be set previously !!!
- computeMeanOutDegree(self)
- Renders the mean degree of self.
!!! self.size must be set previously !!!
- computeMeanSymDegree(self)
- Renders the mean degree of self.
!!! self.size must be set previously !!!
- computeMedianOutDegree(self)
- Renders the median outdegree of self.
!!! self.size must be set previously !!!
- computeMedianSymDegree(self)
- Renders the median symmetric degree of self.
!!! self.size must be set previously !!!
- computeMoreOrLessUnrelatedPairs(self)
- Renders a list of more or less unrelated pairs.
- computeNetFlowsOrder(self)
- Renders an ordered list (from best to worst) of the actions
following the net flows ranking rule.
- computeNetFlowsOrderDict(self)
- Renders an ordered list (from worst to best) of the actions
following the net flows ranking rule.
- computeNetFlowsRanking(self)
- Renders an ordered list (from best to worst) of the actions
following the net flows ranking rule.
- computeNetFlowsRankingDict(self)
- Renders an ordered list (from best to worst) of the actions
following the net flows ranking rule.
- computeODistance(self, op2, comments=False)
- renders the squared normalized distance of
two digraph valuations.
.. note::
op2 = digraphs of same order as self.
- computeOrbit(self, choice, withListing=False)
- renders the set of isomorph copies of a choice following
the automorphism of the digraph self
- computeOrdinalCorrelationMP(self, other, MedianCut=False, Threading=False, nbrOfCPUs=None, startMethod=None, Comments=False, Debug=False)
- Multi processing version of the digraphs.computeOrdinalCorrelation() method.
.. note::
The relation filtering and the MedinaCut option are not implemented in the MP version.
- computePairwiseClusterComparison(self, K1, K2, Debug=False)
- Computes the pairwise cluster comparison credibility vector
from bipolar-valued digraph g. with K1 and K2 disjoint
lists of action keys from g actions disctionary.
Returns the dictionary
{'I': Decimal(),'P+':Decimal(),'P-':Decimal(),'R' :Decimal()}
where one and only one item is strictly positive.
- computePreKernels(self)
- computing dominant and absorbent preKernels:
Result in self.dompreKernels and self.abspreKernels
- computePreRankingRelation(self, preRanking, Normalized=True, Debug=False)
- Renders the bipolar-valued relation obtained from
a given preRanking in decreasing levels (list of lists) result.
- computePreorderRelation(self, preorder, Normalized=True, Debug=False)
- Renders the bipolar-valued relation obtained from
a given preordering in increasing levels (list of lists) result.
- computePrincipalOrder(self, Colwise=False, Comments=False)
- Rendesr an ordering from wrost to best of the decision actions.
- computePrincipalRanking(self, Colwise=False, Comments=False)
- Rendesr a ranking from best to worst of the decision actions.
- computePrincipalScores(self, plotFileName=None, Colwise=False, imageType=None, tempDir=None, bgcolor='cornsilk', Comments=False, Debug=False)
- Renders a ordered list of the first principal eigenvector of the covariance of the valued outdegrees of self.
.. note::
The method, relying on writing and reading temporary files by default in a temporary directory is threading and multiprocessing safe !
(see Digraph.exportPrincipalImage method)
- computePrudentBetaLevel(self, Debug=False)
- computes alpha, ie the lowest valuation level, for which the
bipolarly polarised digraph doesn't contain a chordless circuit.
- computeRankingByBestChoosing(self, CoDual=False, Debug=False)
- Computes a weak preordering of the self.actions by recursive
best choice elagations.
Stores in self.rankingByBestChoosing['result'] a list of (P+,bestChoice) tuples
where P+ gives the best choice complement outranking
average valuation via the computePairwiseClusterComparison
method.
If self.rankingByBestChoosing['CoDual'] is True,
the ranking-by-choosing was computed on the codual of self.
- computeRankingByBestChoosingRelation(self, rankingByBestChoosing=None, Debug=False)
- Renders the bipolar-valued relation obtained from
the self.rankingByBestChoosing result.
- computeRankingByChoosing(self, actionsSubset=None, Debug=False, CoDual=False)
- Computes a weak preordring of the self.actions by iterating
jointly first and last choice elagations.
Stores in self.rankingByChoosing['result'] a list of ((P+,bestChoice),(P-,worstChoice)) pairs
where P+ (resp. P-) gives the best (resp. worst) choice complement outranking
(resp. outranked) average valuation via the computePairwiseClusterComparison
method.
If self.rankingByChoosing['CoDual'] is True, the ranking-by-choosing was computed on the codual of self.
- computeRankingByChoosingRelation(self, rankingByChoosing=None, actionsSubset=None, Debug=False)
- Renders the bipolar-valued relation obtained from
the self.rankingByChoosing result.
- computeRankingByLastChoosing(self, CoDual=False, Debug=False)
- Computes a weak preordring of the self.actions by iterating
worst choice elagations.
Stores in self.rankingByLastChoosing['result'] a list of (P-,worstChoice) pairs
where P- gives the worst choice complement outranked
average valuation via the computePairwiseClusterComparison
method.
If self.rankingByChoosing['CoDual'] is True, the ranking-by-last-chossing
was computed on the codual of self.
- computeRankingByLastChoosingRelation(self, rankingByLastChoosing=None, Debug=False)
- Renders the bipolar-valued relation obtained from
the self.rankingByLastChoosing result.
- computeRankingCorrelation(self, ranking, Debug=False)
- Renders the ordinal correlation K of a digraph instance
when compared with a given linear ranking of its actions
K = sum_{x != y} [ min( max(-self.relation(x,y)),other.relation(x,y), max(self.relation(x,y),-other.relation(x,y)) ]
K /= sum_{x!=y} [ min(abs(self.relation(x,y),abs(other.relation(x,y)) ]
.. note::
Renders a tuple with at position 0 the actual bipolar correlation index
and in position 1 the minimal determination level D of self and
the other relation.
D = sum_{x != y} min(abs(self.relation(x,y)),abs(other.relation(x,y)) / n(n-1)
where n is the number of actions considered.
The correlation index with a completely indeterminate relation
is by convention 0.0 at determination level 0.0 .
- computeRelationalStructure(self, Debug=False)
- Renders the counted decomposition of the valued relations into
the following type of links:
gt '>', eq '=', lt '<', incomp '<>',
leq '<=', geq '>=', indeterm '?'
- computeRubisChoice(self, Comments=False, _OldCoca=False, BrokenCocs=True, Threading=False, nbrOfCPUs=1)
- Renders self.strictGoodChoices, self.nullChoices
self.strictBadChoices, self.nonRobustChoices.
.. warning::
Changes in site the outranking digraph by
adding or braking chordless odd outranking circuits.
- computeRubyChoice(self, Comments=False, _OldCoca=False)
- dummy for computeRubisChoice()
old versions compatibility.
- computeShortestPathLengths(self, WeakPaths=False, Comments=False, Debug=False)
- Renders a double dictionary with the directed distances, i.e. the shortest path lengths between all self.actions.
Equals *None* if there does not exist a directed path between two actions.
*Source*: Claude Berge, *The Theory of Graphs*, Dover (2001) pp. 119, original in French Dunod (1958)
- computeSize(self)
- Renders the number of validated non reflexive arcs
- computeSizeTransitiveClosure(self)
- Renders the size of the transitive closure of a digraph.
- computeSlaterOrder(self, isProbabilistic=False, seed=None, sampleSize=1000, Debug=False)
- Reversed return from computeSlaterRanking method.
- computeSlaterRanking(self, isProbabilistic=False, seed=None, sampleSize=1000, Debug=False)
- Renders a ranking of the actions with minimal Slater index.
Return a tuple: slaterOrder, slaterIndex
- computeSymmetryDegree(self, InPercents=False, Comments=False)
- Renders the symmetry degree (Decimal) of the irreflexive part of a digraph.
.. note::
Empty and indeterminate digraphs are considered to be symmetric.
- computeTopologicalRanking(self, Debug=False)
- Mimetic Wrapper of the topologicalSort() method.
- computeTransitivityDegree(self, InPercents=False, Comments=False)
- Renders the transitivity degree (Decimal) of a digraph.
.. note::
An empty or indeterminate digraph is considered to be transitive.
- computeUnrelatedPairs(self)
- Renders a list of more or less unrelated pairs.
- computeValuationLevels(self, choice=None, Debug=False)
- renders the symmetric closure of the
apparent valuations levels of self
in an increasingly ordered list.
If parameter choice is given, the
computation is limited to the actions
of the choice.
- computeValuationPercentages(self, choice, percentiles, withValues=False)
- Parameters: choice and list of percentiles.
renders a series of percentages of the characteristics valuation of
the arcs in the digraph.
- computeValuationPercentiles(self, choice, percentages, withValues=False)
- Parameters: choice and list of percentages.
renders a series of quantiles of the characteristics valuation of
the arcs in the digraph.
- computeValuationStatistics(self, Sampling=False, Comments=False)
- Renders the mean and variance of the valuation
of the non reflexive pairs.
- computeValuedRankingRelation(self, ranking)
- Renders the valued relation characteristics compatible
with the given linar ranking. Discordant charcateristics
are set to the indeterminate value.
- computeWeakCondorcetLosers(self)
- Wrapper for weakCondorcetLosers().
- computeWeakCondorcetWinners(self)
- Wrapper for weakCondorcetWinners().
- computeupdown1(self, s, S)
- Help method for show_MIS_HB2 method.
fills self.newmisset, self.upmis, self.downmis.
- computeupdown2(self, s, S)
- Help method for show_MIS_HB1 method.
Fills self.newmisset, self.upmis, self.downmis.
- computeupdown2irred(self, s, S)
- Help method for show_MIS_HB1 method.
Fills self.newmisset, self.upmis, self.downmis.
- condorcetLosers(self)
- Renders the set of decision actions x such that
self.relation[x][y] < self.valuationdomain['med']
for all y != x.
- condorcetWinners(self)
- Renders the set of decision actions x such that
self.relation[x][y] > self.valuationdomain['med']
for all y != x.
- contra(self, v)
- Parameter: choice.
Renders the negation of a choice v characteristic's vector.
- convertRelationToDecimal(self)
- Converts the float valued self.relation in a decimal valued one.
- convertValuation2Integer(self, InSite=True, Comments=False)
- Converts the self.relation valuation to integer values by converting the Decimals to Fractions and multiply by the least commun multiple of the fraction denominators.
*Parameters*:
- If *Insite* == False (True by default) the method returns a modified copy of self.relation without altering the original self.relation, otherwise self.relation and self.valuationdomain is modified.
- convertValuationToDecimal(self)
- Convert the float valuation limits to Decimals.
- coveringIndex(self, choice, direction='out')
- Renders the covering index of a given choice in a set of objects,
ie the minimum number of choice members that cover each
non selected object.
- crispKDistance(self, digraph, Debug=False)
- Renders the crisp Kendall distance between two bipolar valued
digraphs.
.. warning::
Obsolete! Is replaced by the self.computeBipolarCorrelation(other, MedianCut=True) Digraph method
- detectChordlessCircuits(self, Comments=False, Debug=False)
- Detects a chordless circuit in a digraph.
Returns a Boolean
- detectChordlessPath(self, Pk, n2, Comments=False, Debug=False)
- New procedure from Agrum study April 2009
recursive chordless path extraction starting from path
Pk = [n2, ...., n1] and ending in node n2.
Optimized with marking of visited chordless P1s.
- determinateness(self, vec, inPercent=True)
- Renders the determinateness of a characteristic vector *vec* =
[(r(x),x),(r(y),y), ...] of length *n* in valuationdomain [Min,Med,Max]:
*result* = sum_x( abs(r(x)-Med) ) / ( n*(Max-Med) )
If inPercent, *result* shifted (+1) and reduced (/2) to [0,1] range.
- digraph2Graph(self, valuationDomain={'min': -1, 'med': 0, 'max': 1}, Debug=False, ConjunctiveConversion=True)
- Convert a Digraph instance to a Graph instance.
- dneighbors(self, node)
- Renders the set of dominated out-neighbors of a node.
- domin(self, choice)
- Renders the dominance degree of a choice.
- dominantChoices(self, S)
- Generates all minimal dominant choices of a bipolar valued digraph.
.. note::
Initiate with S = self.actions.copy().
- domirred(self, choice)
- Renders the crips +irredundance degree of a choice.
- domirredval(self, choice, relation)
- Renders the valued +irredundance degree of a choice.
- domirredx(self, choice, x)
- Renders the crips +irredundance degree of node x in a choice.
- domkernelrestrict(self, prekernel)
- Parameter: dominant prekernel
Renders dominant prekernel restricted relation.
- exportPrincipalImage(self, plotFileName=None, pictureFormat='pdf', bgcolor='cornsilk', fontcolor='red3', fontsize='0.75', Reduced=False, Colwise=False, tempDir='.', Comments=False)
- Export as PDF (default) the principal projection of
the valued relation using the three principal eigen vectors.
Implemeted picture formats are:
'pdf' (default), 'png', 'jpeg' and 'xfig'.
The background color is set by default to 'cornsilk'.
Font size and color are set by default to 'red3', resp. '0.75'.
When *Reduced==True*, the valued relation characeteristics are centered and reduced.
When *Colwise==True*, the column vectors of the adjacency table are used for the principal projection, otherwise the rows (default) are used. Has no incidence when the *Digraph* instance *self* is symmetric.
.. warning::
The method, writing and reading temporary files:
tempCol.r and rotationCol.csv, resp. tempRow.r and rotationRow.csv,
by default in the working directory (./),
is hence not safe for multiprocessing programs, unless a
temporary directory *tempDir* is provided.
- flatChoice(self, ch, Debug=False)
- Converts set or list ch recursively to a flat list of items.
- forcedBestSingleChoice(self)
- Renders the set of most determined outranking singletons in self.
- gammaSets(self)
- Renders the dictionary of neighborhoods {node: (dx,ax)}
with set *dx* gathering the dominated, and set *ax* gathering
the absorbed neighborhood.
- generateAbsPreKernels(self)
- Generate all absorbent prekernels from independent choices generator.
- generateDomPreKernels(self)
- Generate all dominant prekernels from independent choices generator.
- htmlChoiceVector(self, ch, ChoiceVector=True, choiceType='good')
- Show procedure for annotated bipolar choices.
- inDegrees(self)
- renders the median cut indegrees
- inDegreesDistribution(self)
- Renders the distribution of indegrees.
- independentChoices(self, U)
- Generator for all independent choices with neighborhoods of a bipolar valued digraph:
.. note::
* Initiate with U = self.singletons().
* Yields [(independent choice, domnb, absnb, indnb)].
- inner_prod(self, v1, v2)
- Parameters: two choice characteristic vectors
Renders the inner product of two characteristic vetors.
- intstab(self, choice)
- Computes the independence degree of a choice.
- irreflex(self, mat)
- Puts diagonal entries of mat to valuationdomain['min']
- isAsymmetricIndeterminate(self, Debug=False)
- Checks the self.relation for assymmetric indeterminateness!!
.. warning::
The reflexive links are ignored !!
- isComplete(self, Debug=False)
- checks the completeness property of self.relation by checking
for the absence of a link between two actions!!
.. warning::
The reflexive links are ignored !!
- isCyclic(self, Debug=False)
- checks the cyclicity of self.relation by checking
for a reflexive loop in its transitive closure-
.. warning::
self.relation is supposed to be irreflexive !
- isIntegerValued(self, Debug=False)
- Checks whether the decimal valuation of self is integer-valued
be using the as_integer_ratio() method of a Decimal
giving a tuple (numerator,denominator). If denominator == 1, the
number is an integer.
- isOutrankingDigraph(self, Comments=True, Debug=False)
- Checks the outranking digraph characteristic condition (3.3).
relation[x][y] + relation[y][x)[y] >= 0.0
.. warning::
The reflexive links are ignored and the valuation must be bipolar !!
- isStrictOutrankingDigraph(self, Comments=True, Debug=False)
- Checks the strict outranking digraph characteristic condition (3.1).
-(relation[x][y] + relation[y][x]) <= 0.0 , x != y
.. warning::
The reflexive links are ignored and the valuation must be bipolar !!
- isSymmetric(self, Comments=False)
- True if symmetry degree == 1.0.
- isTransitive(self, Comments=False)
- True if transitivity degree == 1.0.
- isWeaklyComplete(self, Debug=False)
- checks the weakly completeness property of self.relation by checking
for the absence of a link between two actions!!
.. warning::
The reflexive links are ignored !!
- iterateRankingByChoosing(self, Odd=False, CoDual=False, Comments=True, Debug=False, Limited=None)
- Renders a ranking by choosing result when progressively eliminating
all chordless (odd only) circuits with rising valuation cut levels.
Parameters
CoDual = False (default)/True
Limited = proportion (in [0,1]) * (max - med) valuationdomain
- kChoices(self, A, k)
- Renders all choices of length k from set A
- matmult2(self, m, v)
- Parameters: digraph relation and choice characteristic vector
matrix multiply vector by inner production
- meanDegree(self)
- Renders the mean degree of self.
!!! self.size must be set previously !!!
- meanLength(self, Oriented=False)
- Renders the (by default non-oriented) mean neighbourhoor depth of self.
!!! self.order must be set previously !!!
- minimalChoices(self, S)
- Generates all dominant or absorbent choices of a bipolar
valued digraph.
.. note:
* Initiate with S = (actions, dict of dominant or absorbent closed neighborhoods)
* See showMinDom and showMinAbs methods.
- minimalValuationLevelForCircuitsElimination(self, Odd=True, Debug=False, Comments=False)
- renders the minimal valuation level <lambda> that eliminates all
self.circuitsList stored odd chordless circuits from self.
.. warning::
The <lambda> level polarised may still contain newly appearing chordless odd circuits !
- neighbourhoodCollection(self, Oriented=False, Potential=False)
- Renders the neighbourhood.
- neighbourhoodDepthDistribution(self, Oriented=False)
- Renders the distribtion of neighbourhood depths.
- notGammaSets(self)
- Renders the dictionary of neighborhoods {node: (dx,ax)}
with set *dx* gathering the not dominated, and set *ax* gathering
the not absorbed neighborhood.
- notaneighbors(self, node)
- Renders the set of absorbed not in-neighbors of a node.
- notdneighbors(self, node)
- Renders the set of not dominated out-neighbors of a node.
- outDegrees(self)
- renders the median cut outdegrees
- outDegreesDistribution(self)
- Renders the distribution of outdegrees.
- plusirredundant(self, U)
- Generates all +irredundant choices of a digraph.
- powerset(self, U)
- Generates all subsets of a set.
- readPerrinMisset(self, file='curd.dat')
- read method for 0-1-char-coded MISs by default from the perrinMIS.c curd.dat result file.
- readabsvector(self, x, relation)
- Parameter: action x
absorbent in vector.
- readdomvector(self, x, relation)
- Parameter: action x
dominant out vector.
- relationFct(self, x, y)
- wrapper for self.relation dictionary access to ensure interoperability
with the sparse and big outranking digraph implementation model.
- save(self, fileName='tempdigraph', option=None, DecimalValuation=True, decDigits=2)
- Persistent storage of a Digraph class instance in the form of
a python source code file
- saveCSV(self, fileName='tempdigraph', Normalized=False, Dual=False, Converse=False, Diagonal=False, Debug=False)
- Persistent storage of a Digraph class instance in the form of
a csv file.
- saveXMCDA2(self, fileName='temp', fileExt='xmcda2', Comments=True, relationName='R', relationType='binary', category='random', subcategory='valued', author='digraphs Module (RB)', reference='saved from Python', valuationType='standard', digits=2, servingD3=False)
- save digraph in XMCDA 2.0 format. Deprecated now.
- savedre(self, fileName='temp')
- save digraph in nauty format.
- sharp(self, x, y)
- Paramaters: choice characteristic values.
Renders the sharpest of two characteristic values x and y.
- sharpvec(self, v, w)
- Paramaters: choice characteristic vectors.
Renders the sharpest of two characteristic vectors v and w.
- showActions(self)
- presentation methods for digraphs actions
- showAttributes(self)
- Prints out the attributes of self.
- showAutomorphismGenerators(self)
- Renders the generators of the automorphism group.
- showBadChoices(self, Recompute=True)
- Characteristic values for potentially bad choices.
- showChoiceVector(self, ch, choiceType='good', ChoiceVector=True)
- Show procedure for annotated bipolar choices.
- showChordlessCircuits(self, Recompute=False)
- Show method for chordless circuits observed in a Digraph instance.
If previous computation is required, stores the detected circuits in self.circuitsList attribute.
- showComponents(self)
- Shows the list of connected components of the digraph instance.
- showCorrelation(self, corr=None, ndigits=3)
- Renders the valued ordinal correlation index, the crisp Kendall tau index and their epistemic determination degree.
- showFirstChoiceRecommendation(self, Verbose=False, Comments=True, ChoiceVector=False, CoDual=True, Debug=False, _OldCoca=False, BrokenCocs=True)
- Shows the RuBis first choice recommendation.
.. note::
Computes by default the Rubis first choice recommendation on the corresponding strict (codual) outranking digraph.
By default, with BrokenCocs=True, we brake all chordless circuits at their weakest determined ( abs(r(x>y)) + abs(r(y>x)) ) link.
When BrokenCocs=False we proceed like follows:
In case of chordless circuits, if supporting arcs are more credible
than the reversed negating arcs, we collapse the circuits into hyper nodes.
Inversely, if supporting arcs are not more credible than the reversed negating arcs,
we brake the circuits on their weakest arc.
Usage example:
>>> from outrankingDigraphs import *
>>> t = Random3ObjectivesPerformanceTableau(seed=5)
>>> g = BipolarOutrankingDigraph(t)
>>> g.showFirstChoiceRecommendation()
***********************
RuBis First Choice Recommendation (BCR)
(in decreasing order of determinateness)
Credibility domain: [-100.0, 100.0]
=== >> potential first choices
* choice : ['a04', 'a14', 'a19', 'a20']
independence : 1.19
dominance : 4.76
absorbency : -59.52
covering (%) : 75.00
determinateness (%) : 57.86
- most credible action(s) = { 'a14': 23.81, 'a19': 11.90, 'a04': 2.38, 'a20': 1.19, }
=== >> potential last choices
* choice : ['a03', 'a12', 'a17']
independence : 4.76
dominance : -76.19
absorbency : 4.76
covering (%) : 0.00
determinateness (%) : 65.39
- most credible action(s) = { 'a03': 38.10, 'a12': 13.10, 'a17': 4.76, }
Execution time: 0.024 seconds
*****************************
- showGoodChoices(self, Recompute=True)
- Characteristic values for potentially good choices.
- showHTMLBestChoiceRecommendation(self, pageTitle=None, ChoiceVector=False, CoDual=True, Debug=False, _OldCoca=False, BrokenCocs=True, htmlFileName=None)
- showHTMLRelationHeatmap(self, actionsList=None, rankingRule='NetFlows', colorLevels=7, tableTitle='Relation Heatmap', relationName='r(x S y)', ndigits=2, fromIndex=None, toIndex=None, htmlFileName=None)
- Launches a browser window with the colored relation map of self.
See corresponding :py:class:`~digraphs.Digraph.showHTMLRelationMap` method.
The *colorLevels* parameter may be set to 3, 5, 7 (default) or 9.
When the *actionsList* parameter is *None* (default), the digraphs actions list may be ranked with the *rankingRule* parameter set to the 'Copeland' (default) or to the 'Netlows' ranking rule.
When the *htmlFileName* parameter is set to a string value 'xxx', a html file named 'xxx.html' will be generated in the current working directory. Otherwise, a temporary file named 'tmp*.html' will be generated there.
Example::
>>> from outrankingDigraphs import *
>>> t = RandomCBPerformanceTableau(numberOfActions=25,seed=1)
>>> g = BipolarOutrankingDigraph(t,ndigits=2)
>>> gcd = ~(-g) # strict outranking relation
>>> gcd.showHTMLRelationHeatmap(colorLevels=7,ndigits=2)
.. image:: relationHeatmap.png
:alt: Browser view of a relation map
:width: 600 px
:align: center
- showMIS(self, withListing=True)
- Prints all maximal independent choices:
Result in self.misset.
- showMIS_AH(self, withListing=True)
- Prints all MIS using the Hertz method.
Result saved in self.hertzmisset.
- showMIS_HB2(self, withListing=True)
- Prints all MIS using the Hertz-Bisdorff method.
Result saved in self.newmisset.
- showMIS_RB(self, withListing=True)
- Prints all MIS using the Bisdorff method.
Result saved in self.newmisset.
- showMIS_UD(self, withListing=True)
- Prints all MIS using the Hertz-Bisdorff method.
Result saved in self.newmisset.
- showMaxAbsIrred(self, withListing=True)
- Computing maximal -irredundant choices:
Result in self.absirset.
- showMaxDomIrred(self, withListing=True)
- Computing maximal +irredundant choices:
Result in self.domirset.
- showMinAbs(self, withListing=True)
- Prints minimal absorbent choices:
Result in self.absset.
- showMinDom(self, withListing=True)
- Prints all minimal dominant choices:
Result in self.domset.
- showNeighborhoods(self)
- Lists the gamma and the notGamma function of self.
- showOrbits(self, InChoices, withListing=True)
- Prints the orbits of Choices along the automorphisms of
the Digraph instance.
Example Python session for computing the non isomorphic MISs from the 12-cycle graph:
>>> from digraphs import *
>>> c12 = CirculantDigraph(order=12,circulants=[1,-1])
>>> c12.automorphismGenerators()
...
Permutations
{'1': '1', '2': '12', '3': '11', '4': '10', '5':
'9', '6': '8', '7': '7', '8': '6', '9': '5', '10':
'4', '11': '3', '12': '2'}
{'1': '2', '2': '1', '3': '12', '4': '11', '5': '10',
'6': '9', '7': '8', '8': '7', '9': '6', '10': '5',
'11': '4', '12': '3'}
Reflections {}
>>> print('grpsize = ', c12.automorphismGroupSize)
grpsize = 24
>>> c12.showMIS(withListing=False)
*--- Maximal independent choices ---*
number of solutions: 29
cardinality distribution
card.: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
freq.: [0, 0, 0, 0, 3, 24, 2, 0, 0, 0, 0, 0, 0]
Results in c12.misset
>>> c12.showOrbits(c12.misset,withListing=False)
...
*---- Global result ----
Number of MIS: 29
Number of orbits : 4
Labelled representatives:
1: ['2','4','6','8','10','12']
2: ['2','5','8','11']
3: ['2','4','6','9','11']
4: ['1','4','7','9','11']
Symmetry vector
stabilizer size: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ...]
frequency : [0, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, ...]
*Figure*: The symmetry axes of the non isomorphic MISs of the 12-cycle:
.. image:: c12.png
:width: 400 px
:align: center
:alt: The 4 non isomorphic MIS of the 12-cycle graph
*Reference*: R. Bisdorff and J.L. Marichal (2008). Counting non-isomorphic maximal independent sets of the n-cycle graph. *Journal of Integer Sequences*, Vol. 11 Article 08.5.7 (`openly accessible here <https://www.cs.uwaterloo.ca/journals/JIS/VOL11/Marichal/marichal.html>`_)
- showOrbitsFromFile(self, InFile, withListing=True)
- Prints the orbits of Choices along the automorphisms of
the digraph self by reading in the 0-1 misset file format.
See the :py:func:`digraphs.Digraph.readPerrinMisset` method.
- showPreKernels(self, withListing=True)
- Printing dominant and absorbent preKernels:
Result in self.dompreKernels and self.abspreKernels
- showRankingByBestChoosing(self, rankingByBestChoosing=None)
- A show method for self.rankinByBestChoosing result.
.. warning::
The self.computeRankingByBestChoosing(CoDual=False/True) method instantiating the self.rankingByBestChoosing slot is pre-required !
- showRankingByChoosing(self, rankingByChoosing=None, WithCoverCredibility=False)
- A show method for self.rankinByChoosing result.
When parameter *WithCoverCredibility* is set to True, the credibility of outranking, respectively being outranked is indicated at each selection step.
.. warning::
The self.computeRankingByChoosing(CoDual=False/True) method instantiating the self.rankingByChoosing slot is pre-required !
- showRankingByLastChoosing(self, rankingByLastChoosing=None, Debug=None)
- A show method for self.rankinByChoosing result.
.. warning::
The self.computeRankingByLastChoosing(CoDual=False/True) method instantiating the self.rankingByChoosing slot is pre-required !
- showRelation(self)
- prints the relation valuation in ##.## format.
- showRubyChoice(self, Verbose=False, Comments=True, _OldCoca=True)
- Dummy for showBestChoiceRecommendation()
needed for older versions compatibility.
- showStatistics(self)
- Computes digraph statistics like order, size and arc-density.
- showdre(self)
- Shows relation in nauty format.
- singletons(self)
- list of singletons and neighborhoods
[(singx1, +nx1, -nx1, not(+nx1 or -nx1)),.... ]
- sizeSubGraph(self, choice)
- Output: (size, undeterm,arcDensity).
Renders the arc density of the induced subgraph.
- strongComponents(self, setPotential=False)
- Renders the set of strong components of self.
- symDegreesDistribution(self)
- Renders the distribution of symmetric degrees.
- topologicalSort(self, Debug=False)
- If self is acyclic, adds topological sort number to each node of self
and renders ordered list of nodes. Otherwise renders None.
Source: M. Golumbic Algorithmic Graph heory and Perfect Graphs,
Annals Of Discrete Mathematics 57 2nd Ed. , Elsevier 2004, Algorithm 2.4 p.44.
- weakAneighbors(self, node)
- Renders the set of absorbed in-neighbors of a node.
- weakCondorcetLosers(self)
- Renders the set of decision actions x such that
self.relation[x][y] <= self.valuationdomain['med']
for all y != x.
- weakCondorcetWinners(self)
- Renders the set of decision actions x such that
self.relation[x][y] >= self.valuationdomain['med']
for all y != x.
- weakDneighbors(self, node)
- Renders the set of dominated out-neighbors of a node.
- weakGammaSets(self)
- Renders the dictionary of neighborhoods {node: (dx,ax)}
- zoomValuation(self, zoomFactor=1.0)
- Zooms in or out, depending on the value of the zoomFactor provided,
the bipolar valuation of a digraph.
Data descriptors inherited from digraphs.Digraph:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Methods inherited from perfTabs.PerformanceTableau:
- computeActionCriterionPerformanceDifferences(self, refAction, refCriterion, comments=False, Debug=False)
- computes the performances differences observed between the reference action and the others on the given criterion
- computeActionCriterionQuantile(self, action, criterion, strategy='average', Debug=False)
- renders the quantile of the performance of action on criterion
- computeActionQuantile(self, action, Debug=False)
- renders the overall performance quantile of action
- computeAllQuantiles(self, Sorted=True, Comments=False)
- renders a html string showing the table of
the quantiles matrix action x criterion
- computeCriterionPerformanceDifferences(self, c, Comments=False, Debug=False)
- Renders the ordered list of all observed performance differences on the given criterion.
- computeDefaultDiscriminationThresholds(self, criteriaList=None, quantile={'ind': 10, 'pref': 20, 'weakVeto': 60, 'veto': 80}, Debug=False, Comments=False)
- updates the discrimination thresholds with the percentiles
from the performance differences.
Parameters: quantile = {'ind': 10, 'pref': 20, 'weakVeto': 60, 'veto: 80}.
- computeMinMaxEvaluations(self, criteria=None, actions=None)
- renders minimum and maximum performances on each criterion
in dictionary form: {'g': {'minimum': x, 'maximum': x}}
- computeMissingDataProportion(self, InPercents=False, Comments=False)
- Renders the proportion of missing data,
i.e. NA == Decimal('-999') entries in self.evaluation.
- computeNormalizedDiffEvaluations(self, lowValue=0.0, highValue=100.0, withOutput=False, Debug=False)
- renders and csv stores (withOutput=True) the
list of normalized evaluation differences observed on the family of criteria
Is only adequate if all criteria have the same
evaluation scale. Therefore the performance tableau is normalized to 0.0-100.0 scales.
- computePerformanceDifferences(self, Comments=False, Debug=False, NotPermanentDiffs=True, WithMaxMin=False)
- Adds to the criteria dictionary the ordered list of all observed performance differences.
- computeQuantileOrder(self, q0=3, q1=0, Threading=False, nbrOfCPUs=None, startMethod=None, Comments=False)
- Renders a linear ordering of the decision actions from a simulation of pre-ranked outranking digraphs.
The pre-ranking simulations range by default from
quantiles=q0 to quantiles=min( 100, max(10,len(self.actions)/10]) ).
The actions are ordered along a decreasing Borda score of their ranking results.
- computeQuantilePreorder(self, Comments=True, Debug=False)
- computes the preorder of the actions obtained from decreasing majority quantiles. The quantiles are recomputed with a call to the self.computeQuantileSort() method.
- computeQuantileRanking(self, q0=3, q1=0, Threading=False, nbrOfCPUs=None, startMethod=None, Comments=False)
- Renders a linear ranking of the decision actions from a simulation of pre-ranked outranking digraphs.
The pre-ranking simulations range by default from
quantiles=q0 to qantiles=min( 100, max(10,len(self.actions)/10) ).
The actions are ordered along an increasing Borda score of their ranking results.
- computeQuantileSort(self)
- shows a sorting of the actions from decreasing majority quantiles
- computeQuantiles(self, Debug=False)
- renders a quantiles matrix action x criterion with the performance quantile of action on criterion
- computeRankingConsensusQuality(self, ranking, Comments=False, Threading=False, nbrOfCPUs=1)
- Renders the marginal criteria correlations with a given ranking with summary.
- computeThresholdPercentile(self, criterion, threshold, Debug=False)
- computes for a given criterion the quantile
of the performance differences of a given constant threshold.
- computeVariableThresholdPercentile(self, criterion, threshold, Debug=False)
- computes for a given criterion the quantile
of the performance differences of a given threshold.
- computeWeightPreorder(self)
- renders the weight preorder following from the given
criteria weights in a list of increasing equivalence
lists of criteria.
- computeWeightedAveragePerformances(self, isNormalized=False, lowValue=0.0, highValue=100.0, isListRanked=False)
- Compute normalized weighted average scores by ignoring missing data.
When *isNormalized* == True (False by default),
transforms all the scores into a common 0-100 scale.
A lowValue and highValue parameter
can be provided for a specific normalisation.
- convert2BigData(self)
- Renders a cPerformanceTableau instance, by converting the action keys to integers and evaluations to floats, including the discrimination thresholds, the case given.
- convertDiscriminationThresholds2Decimal(self)
- convertDiscriminationThresholds2Float(self)
- convertEvaluation2Decimal(self)
- Convert evaluations from obsolete float format to decimal format
- convertEvaluation2Float(self)
- Convert evaluations from decimal format to float
- convertInsite2BigData(self)
- Convert in site a standard formated Performance tableau into a bigData formated instance.
- convertInsite2Standard(self)
- Convert in site a bigData formated Performance tableau back into a standard formated PerformanceTableau instance.
- convertWeight2Decimal(self)
- Convert significance weights from obsolete float format
to decimal format.
- convertWeight2Integer(self)
- Convert significance weights from Decimal format
to int format.
- convertWeights2Negative(self)
- Negates the weights of criteria to be minimzed.
- convertWeights2Positive(self)
- Sets negative weights back to positive weights and negates corresponding evaluation grades.
- csvAllQuantiles(self, fileName='quantiles')
- save quantiles matrix criterionxaction in CSV format
- hasOddWeightAlgebra(self, Debug=False)
- Verify if the given criteria[self]['weight'] are odd or not.
Return a Boolen value.
- normalizeEvaluations(self, lowValue=0.0, highValue=100.0, Debug=False)
- recode the evaluations between lowValue and highValue on all criteria
- quantizeCriterionEvaluations(self, g, q, ndigits=2, Debug=True)
- q-tile evaluation of criterion q
- replaceNA(self, newNA=None, Comments=False)
- Replaces the current self.NA symbol with the *newNA* symbol of type <Decimal>. If newNA is None, the defauklt value Decimal('-999') is used.
- restoreOriginalEvaluations(self, lowValue=0.0, highValue=100.0, Debug=False)
- recode the evaluations to their original values on all criteria
- saveXMCDA2String(self, fileName='temp', category='XMCDA 2.0 format', user='digraphs Module (RB)', version='saved from Python session', title='Performance Tableau in XMCDA-2.0 format.', variant='Rubis', valuationType='bipolar', servingD3=True, comment='produced by stringIO()', stringNA='NA')
- save performance tableau object self in XMCDA 2.0 format.
!!! obsolete: replaced by the isStringIO in the saveXMCDA2 method !!!
- setObjectiveWeights(self, Debug=False)
- Set the objective weights to the sum of the corresponding criteria significance weights.
- showAllQuantiles(self, Sorted=True)
- prints the performance quantiles tableau in the session console.
- showCriteria(self, IntegerWeights=False, Alphabetic=False, ByObjectives=False, Debug=False)
- print Criteria with thresholds and weights.
- showEvaluationStatistics(self)
- renders the variance and standard deviation of
the values observed in the performance Tableau.
- showHTMLCriteria(self, criteriaSubset=None, Sorted=True, ndigits=2, title=None, htmlFileName=None)
- shows the criteria in the system browser view.
- showHTMLPerformanceHeatmap(self, actionsList=None, WithActionNames=False, fromIndex=None, toIndex=None, Transposed=False, criteriaList=None, colorLevels=7, pageTitle=None, ndigits=2, SparseModel=False, outrankingModel='standard', minimalComponentSize=1, rankingRule='NetFlows', StoreRanking=True, quantiles=None, strategy='average', Correlations=False, htmlFileName=None, Threading=False, startMethod=None, nbrOfCPUs=None, Debug=False)
- shows the html heatmap version of the performance tableau in a browser window
(see perfTabs.htmlPerformanceHeatMap() method ).
**Parameters**:
* *actionsList* and *criteriaList*, if provided, give the possibility to show
the decision alternatives, resp. criteria, in a given ordering.
* *WithActionNames* = True (default False) will show the action names instead of the short names or the identifyers.
* *ndigits* = 0 may be used to show integer evaluation values.
* *colorLevels* may be 3, 5, 7, or 9.
* When no *actionsList* is provided, the decision actions are ordered from the best to the worst. This
ranking is obtained by default with the Copeland rule applied on a standard *BipolarOutrankingDigraph*.
* When the *SparseModel* flag is put to *True*, a sparse *PreRankedOutrankingDigraph* construction is used instead.
* the *outrankingModel* parameter (default = 'standard') allows to switch to alternative BipolarOutrankingDigraph constructors, like 'confident' or 'robust' models. When called from a bipolar-valued outrankingDigraph instance, *outrankingModel* = 'this' keeps the current outranking model without recomputing by default the standard outranking model.
* The *minimalComponentSize* allows to control the fill rate of the pre-ranked model.
When *minimalComponentSize* = *n* (the number of decision actions) both the pre-ranked model will be
in fact equivalent to the standard model.
* *rankingRule* = 'NetFlows' (default) | 'Copeland' | 'Kohler' | 'RankedPairs' | 'ArrowRaymond'
| 'IteratedNetFlows' | 'IteraredCopeland'. See tutorial on ranking mith multiple incommensurable criteria.
* when the *StoreRanking* flag is set to *True*, the ranking result is storted in *self*.
* Quantiles used for the pre-ranked decomposition are put by default to *n*
(the number of decision alternatives) for *n* < 50. For larger cardinalities up to 1000, quantiles = *n* /10.
For bigger performance tableaux the *quantiles* parameter may be set to a much lower value
not exceeding usually 10.
* The pre-ranking may be obtained with three ordering strategies for the
quantiles equivalence classes: 'average' (default), 'optimistic' or 'pessimistic'.
* With *Correlations* = *True* and *criteriaList* = *None*, the criteria will be presented from left to right in decreasing
order of the correlations between the marginal criterion based ranking and the global ranking used for
presenting the decision alternatives.
* For large performance Tableaux, *multiprocessing* techniques may be used by setting
*Threading* = *True* in order to speed up the computations; especially when *Correlations* = *True*.
* By default, the number of cores available, will be detected. It may be necessary in a HPC context to indicate the exact number of singled threaded cores in fact allocated to the multiprocessing job.
>>> from randomPerfTabs import RandomPerformanceTableau
>>> rt = RandomPerformanceTableau(seed=100)
>>> rt.showHTMLPerformanceHeatmap(colorLevels=5,Correlations=True)
.. image:: perfTabsExample.png
:alt: HTML heat map of the performance tableau
:width: 600 px
:align: center
- showHTMLPerformanceQuantiles(self, Sorted=True, htmlFileName=None)
- shows the performance quantiles tableau in a browser window.
- showHTMLPerformanceTableau(self, actionsSubset=None, fromIndex=None, toIndex=None, isSorted=False, Transposed=False, ndigits=2, ContentCentered=True, title=None, htmlFileName=None)
- shows the html version of the performance tableau in a browser window.
- showObjectives(self)
- showQuantileSort(self, Debug=False)
- Wrapper of computeQuantilePreorder() for the obsolete showQuantileSort() method.
- showRankingConsensusQuality(self, ranking)
- shows the marginal criteria correlations with a given ranking with summary.
- showWeightPreorder(self)
- Renders a preordering of the the criteria signficance weights.
| |