当前位置: 首页>>代码示例>>Python>>正文


Python PyXMCDA.getParameterByName方法代码示例

本文整理汇总了Python中PyXMCDA.getParameterByName方法的典型用法代码示例。如果您正苦于以下问题:Python PyXMCDA.getParameterByName方法的具体用法?Python PyXMCDA.getParameterByName怎么用?Python PyXMCDA.getParameterByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyXMCDA的用法示例。


在下文中一共展示了PyXMCDA.getParameterByName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_credibility

# 需要导入模块: import PyXMCDA [as 别名]
# 或者: from PyXMCDA import getParameterByName [as 别名]
 def get_credibility(*args, **kwargs):
     alternatives = px.getAlternativesID(trees['alternatives'])
     comparison_with = kwargs.get('comparison_with')
     if not comparison_with:
         comparison_with = px.getParameterByName(
             trees['method_parameters'],
             'comparison_with',
         )
     if comparison_with in ('boundary_profiles', 'central_profiles'):
         categories_profiles = _get_categories_profiles(
             trees['categories_profiles'],
             comparison_with,
         )
     else:
         categories_profiles = None
     eliminate_cycles_method = px.getParameterByName(
         trees.get('method_parameters'),
         'eliminate_cycles_method',
     )
     tree = trees.get('credibility')
     if eliminate_cycles_method == 'cut_weakest' and tree is None:
         raise InputDataError(
             "'cut_weakest' option requires credibility as an additional "
             "input (apart from outranking)."
         )
     credibility = _get_alternatives_comparisons(
         tree,
         alternatives,
         categories_profiles=categories_profiles,
     )
     return credibility  # NoneType, Vividict
开发者ID:Verdasca,项目名称:Diviz_server,代码行数:33,代码来源:common.py

示例2: get_discordance

# 需要导入模块: import PyXMCDA [as 别名]
# 或者: from PyXMCDA import getParameterByName [as 别名]
 def get_discordance(*args, **kwargs):
     alternatives = px.getAlternativesID(trees['alternatives'])
     comparison_with = px.getParameterByName(
         trees['method_parameters'],
         'comparison_with',
     )
     if kwargs.get('use_partials') is not None:
         use_partials = kwargs.get('use_partials')
     else:
         parameter = px.getParameterByName(
             trees['method_parameters'],
             'use_partials',
         )
         use_partials = True if parameter == 'true' else False
     if comparison_with in ('boundary_profiles', 'central_profiles'):
         categories_profiles = _get_categories_profiles(
             trees['categories_profiles'],
             comparison_with,
         )
     else:
         categories_profiles = None
     discordance = _get_alternatives_comparisons(
         trees['discordance'],
         alternatives,
         categories_profiles=categories_profiles,
         use_partials=use_partials,
     )
     return discordance  # Vividict
开发者ID:Verdasca,项目名称:Diviz_server,代码行数:30,代码来源:common.py

示例3: get_input_data

# 需要导入模块: import PyXMCDA [as 别名]
# 或者: from PyXMCDA import getParameterByName [as 别名]
def get_input_data(input_dir):
    file_names = (
        'alternatives.xml',
        'method_parameters.xml',
        'outranking.xml',
    )
    trees = get_trees(input_dir, file_names)

    alternatives = px.getAlternativesID(trees['alternatives'])
    alternatives.sort()
    outranking = get_intersection_distillation(trees['outranking'], alternatives)
    if outranking == None:
        outranking = px.getAlternativesComparisons(trees['outranking'], alternatives)
    eliminate_cycles_method = px.getParameterByName(trees['method_parameters'],
                                                    'eliminate_cycles_method')
    if eliminate_cycles_method not in ['aggregate', 'cut_weakest']:
        raise RuntimeError("Invalid/missing method for cycle elimination.")
    cut_threshold = px.getParameterByName(trees['method_parameters'], 'cut_threshold')
    check_cut_threshold(cut_threshold)

    ret = {
        'alternatives': alternatives,
        'cut_threshold': cut_threshold,
        'eliminate_cycles_method': eliminate_cycles_method,
        'outranking': outranking,
    }
    return ret
开发者ID:sbigaret,项目名称:electre_diviz,代码行数:29,代码来源:ElectreIsFindKernel.py

示例4: get_input_data

# 需要导入模块: import PyXMCDA [as 别名]
# 或者: from PyXMCDA import getParameterByName [as 别名]
def get_input_data(input_dir):
    file_names = (
        'alternatives.xml',
        'criteria.xml',
        'interactions.xml',
        'method_parameters.xml',
        'performance_table.xml',
        'weights.xml',
    )
    trees = get_trees(input_dir, file_names)

    alternatives = px.getAlternativesID(trees['alternatives'])
    criteria = px.getCriteriaID(trees['criteria'])
    pref_directions = px.getCriteriaPreferenceDirections(trees['criteria'], criteria)
    thresholds = px.getConstantThresholds(trees['criteria'], criteria)
    weights = px.getCriterionValue(trees['weights'], criteria)
    performances = px.getPerformanceTable(trees['performance_table'], 1, 1)
    interactions = get_criteria_interactions(trees['interactions'], criteria)

    check_net_balance(interactions, weights)
    z_function = px.getParameterByName(trees['method_parameters'], 'z_function')

    ret = {
        'alternatives': alternatives,
        'criteria': criteria,
        'interactions': interactions,
        'performances': performances,
        'pref_directions': pref_directions,
        'thresholds': thresholds,
        'weights': weights,
        'z_function': z_function,
    }
    return ret
开发者ID:sbigaret,项目名称:electre_diviz,代码行数:35,代码来源:ElectreCriteriaInteractionsConcordance.py

示例5: makeDistilation

# 需要导入模块: import PyXMCDA [as 别名]
# 或者: from PyXMCDA import getParameterByName [as 别名]
def makeDistilation(
    in_selected, in_alternatives, in_credibility, out_descending, out_ascending, out_medianPreorder, out_final
):
    xml_alternatives = px.parseValidate(in_alternatives)
    xml_selected = px.parseValidate(in_selected)
    xml_alternatives = px.parseValidate(in_alternatives)
    xml_credibility = px.parseValidate(in_credibility)
    if xml_selected == None:
        raise ValueError, "Invalid selected file"
    if xml_alternatives == None:
        raise ValueError, "Invalid alternative file"
    if xml_credibility == None:
        raise ValueError, "Invalid credibility file"

    onCriterion = px.getParameterByName(xml_selected, "selectedCriterion")
    alternativesID = px.getAlternativesID(xml_alternatives)
    alternativesComparisions = getAlternativesComparisonsAtCriteria(xml_credibility, alternativesID)

    if not alternativesComparisions.has_key(onCriterion):
        raise ValueError, "Invalid selected criterion"

    distillation = Distillation(alternativesID, alternativesComparisions[onCriterion])

    output_distillation(out_ascending, distillation.downwards(), "downward distillation", onCriterion)
    output_distillation(out_descending, distillation.upwards(), "upward distillation", onCriterion)
    output_distillation(out_medianPreorder, distillation.medianPreorder(), "median Preorder", onCriterion)

    writeAlternativeComparision(out_final, distillation.intersectionUpDowns, "outranks", onCriterion)
开发者ID:wacaw,项目名称:electreh-diviz,代码行数:30,代码来源:divizDistillation.py

示例6: get_input_data

# 需要导入模块: import PyXMCDA [as 别名]
# 或者: from PyXMCDA import getParameterByName [as 别名]
def get_input_data(input_dir):
    file_names = (
        'alternatives.xml',
        'concordance.xml',
        'method_parameters.xml',
        'discordance_binary.xml',
    )
    trees = get_trees(input_dir, file_names)

    alternatives = px.getAlternativesID(trees['alternatives'])
    # we can also get alternatives from 'concordance.xml', therefore 'alternatives.xml'
    # can be optional - like here:
    # alternatives = list(set([i.text for i in trees['concordance'].findall(".//alternativeID")]))
    concordance = px.getAlternativesComparisons(trees['concordance'], alternatives)
    discordance_binary = px.getAlternativesComparisons(trees['discordance_binary'], alternatives)
    cut_threshold = px.getParameterByName(trees['method_parameters'], 'cut_threshold')
    check_cut_threshold(cut_threshold)

    ret = {
        'alternatives': alternatives,
        'concordance': concordance,
        'cut_threshold': cut_threshold,
        'discordance_binary': discordance_binary,
    }
    return ret
开发者ID:sbigaret,项目名称:electre_diviz,代码行数:27,代码来源:ElectreIsOutrankingBinary.py

示例7: get_input_data

# 需要导入模块: import PyXMCDA [as 别名]
# 或者: from PyXMCDA import getParameterByName [as 别名]
def get_input_data(input_dir):
    file_names = (
        'alternatives.xml',
        'categories.xml',
        'categoriesProfiles.xml',
        'credibility.xml',
        'method_parameters.xml',
    )
    trees = get_trees(input_dir, file_names)

    alternatives = px.getAlternativesID(trees['alternatives'])
    categories = px.getCategoriesID(trees['categories'])
    categories_rank = px.getCategoriesRank(trees['categories'], categories)
    categories_profiles = get_categories_profiles_central(trees['categoriesProfiles'])
    credibility = getAlternativesComparisons(trees['credibility'], alternatives,
                                             categories_profiles)
    cut_threshold = px.getParameterByName(trees['method_parameters'], 'cut_threshold')
    check_cut_threshold(cut_threshold)

    ret = {
        'alternatives': alternatives,
        'categories_rank': categories_rank,
        'categories_profiles': categories_profiles,
        'credibility': credibility,
        'cut_threshold': cut_threshold,
    }
    return ret
开发者ID:sbigaret,项目名称:electre_diviz,代码行数:29,代码来源:ElectreTriCClassAssign.py

示例8: get_cut_threshold

# 需要导入模块: import PyXMCDA [as 别名]
# 或者: from PyXMCDA import getParameterByName [as 别名]
 def get_cut_threshold(*args, **kwargs):
     cut_threshold = px.getParameterByName(
         trees['method_parameters'],
         'cut_threshold',
     )
     if cut_threshold is None or not (0 <= float(cut_threshold) <= 1):
         raise InputDataError(
             "'cut_threshold' should be in range [0, 1] "
             "(most commonly used values are 0.6 or 0.7)."
         )
     return cut_threshold  # float
开发者ID:Verdasca,项目名称:Diviz_server,代码行数:13,代码来源:common.py

示例9: get_categories_profiles

# 需要导入模块: import PyXMCDA [as 别名]
# 或者: from PyXMCDA import getParameterByName [as 别名]
 def get_categories_profiles(*args, **kwargs):
     comparison_with = kwargs.get('comparison_with')
     if comparison_with is None:
         comparison_with = px.getParameterByName(
             trees['method_parameters'],
             'comparison_with',
         )
     categories_profiles = _get_categories_profiles(
         trees.get('categories_profiles'),
         comparison_with,
     )
     return categories_profiles  # NoneType, dict, list
开发者ID:Verdasca,项目名称:Diviz_server,代码行数:14,代码来源:common.py

示例10: makeSelection

# 需要导入模块: import PyXMCDA [as 别名]
# 或者: from PyXMCDA import getParameterByName [as 别名]
def makeSelection(in_selected, in_outranking, out_outranking):
    xml_outranking = px.parseValidate(in_outranking)
    xml_selected = px.parseValidate(in_selected)
    if xml_selected == None:
        raise ValueError, "Invalid selected file"
    if xml_outranking == None:
        raise ValueError, "Invalid xml_outranking file"

    onCriterion = px.getParameterByName(xml_selected, 'selectedCriterion')
    alternativesComparisions = getAlternativesComparisonsAtCriteria(xml_outranking)

    if not alternativesComparisions.has_key(onCriterion):
        raise ValueError, 'Invalid selected criterion'
    writeAlternativeComparisionOnCriterion(out_outranking, alternativesComparisions, onCriterion, 'outranks')
开发者ID:wacaw,项目名称:electreh-diviz,代码行数:16,代码来源:selectOneCriterion.py

示例11: get_profiles_performance_table

# 需要导入模块: import PyXMCDA [as 别名]
# 或者: from PyXMCDA import getParameterByName [as 别名]
 def get_profiles_performance_table(*args, **kwargs):
     comparison_with = px.getParameterByName(
         trees['method_parameters'],
         'comparison_with',
     )
     if comparison_with in ('boundary_profiles', 'central_profiles'):
         tree = trees.get('profiles_performance_table')
         if tree is None:
             msg = (
                 "Missing profiles performance table (did you forget "
                 "to provide 'profiles_performance_table.xml' file?)."
             )
             raise InputDataError(msg)
         profiles_performance_table = px.getPerformanceTable(tree, None, None)
     else:
         profiles_performance_table = None
     return profiles_performance_table  # NoneType, dict
开发者ID:Verdasca,项目名称:Diviz_server,代码行数:19,代码来源:common.py

示例12: check_concordance

# 需要导入模块: import PyXMCDA [as 别名]
# 或者: from PyXMCDA import getParameterByName [as 别名]
def check_concordance(xml_concordance, hierarchyArray, outfile):
    ret = ""
    concordances = px.getCriterionValue(
        xml_concordance, [(getOriginalName(v)) for v, k in hierarchyArray.items()], "Concordance"
    )
    if concordances.__len__() > 0:
        concordances = calculate_new_concordance(concordances, hierarchyArray)
        output_criteriaValues(outfile, concordances, "Concordance")
    else:
        check = px.getParameterByName(xml_concordance, "percentage", "concordanceLevel")
        if check != None:
            content = (
                """
    <methodParameters name="concordanceLevel">
        <parameter name="percentage">
            <value><real>%f</real></value>
        </parameter>
    </methodParameters>"""
                % check
            )
            write_xmcda_content(outfile, content)
开发者ID:wacaw,项目名称:electreh-diviz,代码行数:23,代码来源:checkCriteriaHierarchy.py

示例13: get_cv_crossed

# 需要导入模块: import PyXMCDA [as 别名]
# 或者: from PyXMCDA import getParameterByName [as 别名]
 def get_cv_crossed(*args, **kwargs):
     # 'cv_crossed' stands for 'counter-veto crossed'
     alternatives = px.getAlternativesID(trees['alternatives'])
     comparison_with = px.getParameterByName(
         trees['method_parameters'],
         'comparison_with',
     )
     if comparison_with in ('boundary_profiles', 'central_profiles'):
         categories_profiles = _get_categories_profiles(
             trees['categories_profiles'],
             comparison_with,
         )
     else:
         categories_profiles = None
     cv_crossed = _get_alternatives_comparisons(
         trees['counter_veto_crossed'],
         alternatives,
         categories_profiles=categories_profiles,
         use_partials=True,
         mcda_concept='counterVetoCrossed',
     )
     return cv_crossed  # Vividict
开发者ID:Verdasca,项目名称:Diviz_server,代码行数:24,代码来源:common.py

示例14: get_concordance

# 需要导入模块: import PyXMCDA [as 别名]
# 或者: from PyXMCDA import getParameterByName [as 别名]
 def get_concordance(*args, **kwargs):
     alternatives = px.getAlternativesID(trees['alternatives'])
     comparison_with = px.getParameterByName(
         trees['method_parameters'],
         'comparison_with',
     )
     if comparison_with in ('boundary_profiles', 'central_profiles'):
         categories_profiles = _get_categories_profiles(
             trees['categories_profiles'],
             comparison_with,
         )
         concordance = _get_alternatives_comparisons(
             trees['concordance'],
             alternatives,
             categories_profiles,
         )
     else:
         concordance = px.getAlternativesComparisons(
             trees['concordance'],
             alternatives,
         )
     return concordance  # Vividict, dict
开发者ID:Verdasca,项目名称:Diviz_server,代码行数:24,代码来源:common.py

示例15: get_criterion_concordance_cutting_level_value

# 需要导入模块: import PyXMCDA [as 别名]
# 或者: from PyXMCDA import getParameterByName [as 别名]
def get_criterion_concordance_cutting_level_value (xmltree, mcdaConcept=None) :

    if mcdaConcept == None :
        strSearch = "criteriaValues"
    else :
        strSearch = "criteriaValues[@mcdaConcept=\'" + mcdaConcept + "\']"
    try:
        criteriaValues = xmltree.xpath(strSearch)[0]
    except:
        criteriaValues = None
        #return {}

    if criteriaValues is None:
        return px.getParameterByName(xmltree, 'percentage', 'concordanceLevel')

    values = {}

    for criterionValue in criteriaValues.findall("./criterionValue"):
        crit = criterionValue.find ("criterionID").text
        values[crit] = px.getValue (criterionValue)

    return values
开发者ID:wacaw,项目名称:electreh-diviz,代码行数:24,代码来源:electreH.py


注:本文中的PyXMCDA.getParameterByName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。