xmcda (version $Revision: Python 3.10)
index
/home/bisdorff/Documents/GitHub/Digraph3/pyDoc/xmcda.py

Python3+ implementation of xmcda tools
 
.. warning::
 
   These resources are now deprecated and should no more be considered for ongoing usage!! They were developped in the context of now obsolete xml encoded web services deployments. A replacement alternative is given with the standard save() methods of performance tableaux, digraphs and graphs. 
  
Copyright (C) 2016-2022  Raymond Bisdorff
 
    This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
 
    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

 
Modules
       
itertools
collections.abc
codecs
decimal
json
multiprocessing
os
string
sys
tempfile

 
Functions
       
dumps(obj, protocol=None, *, fix_imports=True, buffer_callback=None)
Return the pickled representation of the object as a bytes object.
 
The optional *protocol* argument tells the pickler to use the given
protocol; supported protocols are 0, 1, 2, 3, 4 and 5.  The default
protocol is 4. It was introduced in Python 3.4, and is incompatible
with previous versions.
 
Specifying a negative protocol version selects the highest protocol
version supported.  The higher the protocol used, the more recent the
version of Python needed to read the pickle produced.
 
If *fix_imports* is True and *protocol* is less than 3, pickle will
try to map the new Python 3 names to the old module names used in
Python 2, so that the pickle data stream is readable with Python 2.
 
If *buffer_callback* is None (the default), buffer views are serialized
into *file* as part of the pickle stream.  It is an error if
*buffer_callback* is not None and *protocol* is None or smaller than 5.
load(file, *, fix_imports=True, encoding='ASCII', errors='strict', buffers=())
Read and return an object from the pickle data stored in a file.
 
This is equivalent to ``Unpickler(file).load()``, but may be more
efficient.
 
The protocol version of the pickle is detected automatically, so no
protocol argument is needed.  Bytes past the pickled object's
representation are ignored.
 
The argument *file* must have two methods, a read() method that takes
an integer argument, and a readline() method that requires no
arguments.  Both methods should return bytes.  Thus *file* can be a
binary file object opened for reading, an io.BytesIO object, or any
other custom object that meets this interface.
 
Optional keyword arguments are *fix_imports*, *encoding* and *errors*,
which are used to control compatibility support for pickle stream
generated by Python 2.  If *fix_imports* is True, pickle will try to
map the old Python 2 names to the new names used in Python 3.  The
*encoding* and *errors* tell pickle how to decode 8-bit string
instances pickled by Python 2; these default to 'ASCII' and 'strict',
respectively.  The *encoding* can be 'bytes' to read these 8-bit
string instances as bytes objects.
loads(data, /, *, fix_imports=True, encoding='ASCII', errors='strict', buffers=())
Read and return an object from the given pickle data.
 
The protocol version of the pickle is detected automatically, so no
protocol argument is needed.  Bytes past the pickled object's
representation are ignored.
 
Optional keyword arguments are *fix_imports*, *encoding* and *errors*,
which are used to control compatibility support for pickle stream
generated by Python 2.  If *fix_imports* is True, pickle will try to
map the old Python 2 names to the new names used in Python 3.  The
*encoding* and *errors* tell pickle how to decode 8-bit string
instances pickled by Python 2; these default to 'ASCII' and 'strict',
respectively.  The *encoding* can be 'bytes' to read these 8-bit
string instances as bytes objects.
saveRobustRubisChoiceXSL(fileName='xmcda2RubisRobustChoice.xsl')
Save the robust version of the Rubis Best-Choice XMCDA 2.0 XSL style sheet in the current working directory
This style sheet allows to browse an XMCDA 2.0 encoded robust Rubis Best-Choice recommendation.
 
.. note::
 
    When accessing an XMCDA encoded data file in a browser, for safety reasons, the corresponding XSL style sheet
    must be present in the same working directory.
saveRubisChoiceXSL(fileName='xmcda2RubisChoice.xsl')
Save the local Rubis Best-Choice XMCDA 2.0 XSL style sheet in the current working directory
This style sheet allows to browse an XMCDA 2.0 encoded Rubis Best-Choice recommendation.
 
.. note::
 
    When accessing an XMCDA encoded data file in a browser, for safety reasons, the corresponding XSL style sheet
    must be present in the same working directory.
saveRubisXSL(fileName='xmcda2Rubis.xsl', Extended=True)
Save the standard Rubis XMCDA 2.0 XSL style sheet in the current working directory.
This style sheet allows to visualize an XMCDA 2.0 encoded performance tableau in a browser.
 
.. note::
 
    When accessing an XMCDA encoded data file in a browser, for safety reasons, the corresponding XSL style sheet
    must be present in the same working directory.
saveXMCDARubisBestChoiceRecommendation(problemFileName=None, tempDir='.', valuationType=None)
Store an XMCDA2 encoded solution file of the Rubis best-choice recommendation.
 
  The valuationType parameter allows to work:
 
    - on the standard bipolar outranking digraph (valuationType = 'bipolar', default),
    - on the normalized --[-1,1] valued-- bipolar outranking digraph (valuationType = 'normalized'),
    - on the robust --ordinal criteria weights-- bipolar outranking digraph (valuationType = 'robust'),
    - on the confident outranking digraph (valuationType = 'confident'),
    - ignoring considerable performances differences (valuationType = 'noVeto').  
 
.. note::
 
     The method requires an Unix like OS like Ubuntu or Mac OSX and depends on:
 
          - the R statistics package for Principal Component Analysis graphic,
          - the C calmat matrix interpreter (see Digraph3/calmat/README)
          - the xpdf ressources ( ...$ apt-get install xpdf on Ubuntu) for converting pdf files to ppm format, and ppm files to png format.
showXMCDARubisBestChoiceRecommendation(problemFileName=None, valuationType=None)
Launches a browser window with the XMCDA2 solution of the
Rubis Solver computed from a stored XMCDA2 encoded performance tableau.
 
The valuationType parameter allows to work:
 
    - on the standard bipolar outranking digraph (valuationType = 'bipolar', default),
    - on the normalized --[-1,1] valued-- bipolar outranking digraph (valuationType = 'normalized'),
    - on the robust --ordinal criteria weights-- bipolar outranking digraph (valuationType = 'robust'),
    - on the confident outranking digraph (valuationType = 'confident'),
    - ignoring considerable performances differences (valuationType = 'noVeto').
 
Example::
 
    >>> import xmcda
    >>> from randomPerfTabs import RandomCBPerformanceTableau
    >>> t = RandomCBPerformanceTableau()
    >>> t.saveXMCDA2('example')
    >>> xmcda.showXMCDARubisBestChoiceRecommendation(problemFileName='example')
time(...)
time() -> floating point number
 
Return the current time in seconds since the Epoch.
Fractions of a second may be present if the system clock provides them.

 
Data
        colorPalettes = {1: ['none', '#EA2027', '#006266', '#1B1464', '#5758BB', '#6F1E51', '#EE5A24', '#009432', '#0652DD', '#9980FA', '#833471', '#F79F1F', '#A3CB38', '#1289A7', '#D980FA', '#B53471', '#FFC312', '#C4E538', '#12CBC4', '#FDA7DF', ...], 2: ['black', 'blue', 'coral', 'gold', 'gray', 'black', 'pink', 'green', 'orange', 'skyblue', 'wheat', 'salmon'], 3: ['none', 'black', 'red', 'cyan', 'green', 'brown', 'blue', 'gold', 'orange', 'grey', 'green2']}
robustRubisXSL = '<?xml version="1.0" encoding="utf-8"?>\n<xsl:styl...</table>\n</xsl:template>\n \n</xsl:stylesheet>\n '
rubisChoiceXSL = '<?xml version="1.0" encoding="utf-8"?>\n<xsl:styl...</table>\n</xsl:template>\n \n</xsl:stylesheet>\n '
rubisExtXSL = '<?xml version="1.0" encoding="utf-8"?>\n<xsl:styl...</table>\n</xsl:template>\n \n</xsl:stylesheet>\n '
rubisXSL = '<?xml version="1.0" encoding="utf-8"?>\n<xsl:styl...</table>\n</xsl:template>\n \n</xsl:stylesheet>\n '