def main(): try: args = docopt(__doc__, version=__version__) input_dir, output_dir = get_dirs(args) input_data = get_input_data(input_dir) alternatives = input_data['alternatives'] categories_profiles = input_data['categories_profiles'] performances = input_data['performances'] profiles_performance_table = input_data['profiles_performance_table'] criteria = input_data['criteria'] pref_directions = input_data['pref_directions'] thresholds = input_data['thresholds'] weights = input_data['weights'] concordance = get_concordance(alternatives, categories_profiles,performances, profiles_performance_table, criteria, thresholds, pref_directions, weights) xmcda = comparisons_to_xmcda(concordance, mcdaConcept="alternativesProfilesComparisons") write_xmcda(xmcda, os.path.join(output_dir, 'concordance.xml')) create_messages_file(('Everything OK.',), None, output_dir) return 0 except Exception, err: traceback.print_exc() err_msg = get_error_message(err) create_messages_file(None, (err_msg, ), output_dir) return 1
def main(): try: args = docopt(__doc__, version=__version__) input_dir, output_dir = get_dirs(args) input_data = get_input_data(input_dir) alternatives = input_data['alternatives'] categories_profiles = input_data['categories_profiles'] criteria = input_data['criteria'] thresholds = input_data['thresholds'] performances = input_data['performances'] pref_directions = input_data['pref_directions'] profiles_performance_table = input_data['profiles_performance_table'] discordances = get_discordances(alternatives, categories_profiles, criteria, thresholds, performances, pref_directions, profiles_performance_table) xmcda = comparisons_to_xmcda(discordances, partials=True, mcdaConcept="alternativesProfilesComparisons") write_xmcda(xmcda, os.path.join(output_dir, 'discordances.xml')) create_messages_file(('Everything OK.',), None, output_dir) return 0 except Exception, err: traceback.print_exc() err_msg = get_error_message(err) create_messages_file(None, (err_msg, ), output_dir) return 1
def main(): try: args = docopt(__doc__, version=__version__) input_dir, output_dir = get_dirs(args) input_data = get_input_data(input_dir) alternatives = input_data['alternatives'] performances = input_data['performances'] criteria = input_data['criteria'] interactions = input_data['interactions'] pref_directions = input_data['pref_directions'] thresholds = input_data['thresholds'] weights = input_data['weights'] z_function = input_data['z_function'] concordance = get_concordance(alternatives, performances, criteria, thresholds, pref_directions, weights, interactions, z_function) xmcda = comparisons_to_xmcda(concordance) write_xmcda(xmcda, os.path.join(output_dir, 'concordance.xml')) create_messages_file(('Everything OK.',), None, output_dir) return 0 except Exception, err: traceback.print_exc() err_msg = get_error_message(err) create_messages_file(None, (err_msg, ), output_dir) return 1
def main(): try: args = docopt(__doc__, version=__version__) output_dir = None input_dir, output_dir = get_dirs(args) filenames = [ # every tuple below == (filename, is_optional) ('alternatives.xml', False), ('classes_profiles.xml', True), ('criteria.xml', False), ('method_parameters.xml', False), ('performance_table.xml', False), ('profiles_performance_table.xml', True), ] params = [ 'alternatives', 'categories_profiles', 'comparison_with', 'criteria', 'performances', 'pref_directions', 'profiles_performance_table', 'thresholds', ] d = get_input_data(input_dir, filenames, params) # getting the elements to compare comparables_a = d.alternatives comparables_perf_a = d.performances if d.comparison_with in ('boundary_profiles', 'central_profiles'): comparables_b = d.categories_profiles comparables_perf_b = d.profiles_performance_table else: comparables_b = d.alternatives comparables_perf_b = d.performances credibility = get_credibility(comparables_a, comparables_perf_a, comparables_b, comparables_perf_b, d.criteria, d.pref_directions, d.thresholds) # serialization etc. if d.comparison_with in ('boundary_profiles', 'central_profiles'): mcda_concept = 'alternativesProfilesComparisons' else: mcda_concept = None comparables = (comparables_a, comparables_b) xmcda = comparisons_to_xmcda(credibility, comparables, mcda_concept=mcda_concept) write_xmcda(xmcda, os.path.join(output_dir, 'credibility.xml')) create_messages_file(None, ('Everything OK.', ), output_dir) return 0 except Exception, err: err_msg = get_error_message(err) log_msg = traceback.format_exc() print(log_msg.strip()) create_messages_file((err_msg, ), (log_msg, ), output_dir) return 1
def main(): try: args = docopt(__doc__, version=__version__) output_dir = None input_dir, output_dir = get_dirs(args) filenames = [ # every tuple below == (filename, is_optional) ('alternatives.xml', False), ('classes_profiles.xml', True), ('criteria.xml', False), ('method_parameters.xml', False), ('performance_table.xml', False), ('profiles_performance_table.xml', True), ] params = [ 'alternatives', 'categories_profiles', 'comparison_with', 'criteria', 'performances', 'pref_directions', 'profiles_performance_table', 'thresholds', ] d = get_input_data(input_dir, filenames, params) # getting the elements to compare comparables_a = d.alternatives comparables_perf_a = d.performances if d.comparison_with in ('boundary_profiles', 'central_profiles'): comparables_b = d.categories_profiles comparables_perf_b = d.profiles_performance_table else: comparables_b = d.alternatives comparables_perf_b = d.performances credibility = get_credibility(comparables_a, comparables_perf_a, comparables_b, comparables_perf_b, d.criteria, d.pref_directions, d.thresholds) # serialization etc. if d.comparison_with in ('boundary_profiles', 'central_profiles'): mcda_concept = 'alternativesProfilesComparisons' else: mcda_concept = None comparables = (comparables_a, comparables_b) xmcda = comparisons_to_xmcda(credibility, comparables, mcda_concept=mcda_concept) write_xmcda(xmcda, os.path.join(output_dir, 'credibility.xml')) create_messages_file(None, ('Everything OK.',), output_dir) return 0 except Exception, err: err_msg = get_error_message(err) log_msg = traceback.format_exc() print(log_msg.strip()) create_messages_file((err_msg, ), (log_msg, ), output_dir) return 1
def main(): try: args = docopt(__doc__, version=__version__) output_dir = None input_dir, output_dir = get_dirs(args) filenames = [ # every tuple below == (filename, is_optional) ('alternatives.xml', False), ('classes_profiles.xml', True), ('concordance.xml', False), ('counter_veto_crossed.xml', False), ('discordance.xml', False), ('method_parameters.xml', False), ] params = [ 'alternatives', 'categories_profiles', 'comparison_with', 'concordance', 'cv_crossed', 'discordance', 'only_max_discordance', 'with_denominator', ] d = get_input_data(input_dir, filenames, params, use_partials=True) # getting the elements to compare comparables_a = d.alternatives if d.comparison_with in ('boundary_profiles', 'central_profiles'): # central_profiles is a dict, so we need to get the keys comparables_b = [i for i in d.categories_profiles] else: comparables_b = d.alternatives credibility = get_credibility(comparables_a, comparables_b, d.concordance, d.discordance, d.with_denominator, d.only_max_discordance, d.cv_crossed) # serialization etc. if d.comparison_with in ('boundary_profiles', 'central_profiles'): mcda_concept = 'alternativesProfilesComparisons' else: mcda_concept = None comparables = (comparables_a, comparables_b) xmcda = comparisons_to_xmcda(credibility, comparables, mcda_concept=mcda_concept) write_xmcda(xmcda, os.path.join(output_dir, 'credibility.xml')) create_messages_file(None, ('Everything OK.', ), output_dir) return 0 except Exception, err: err_msg = get_error_message(err) log_msg = traceback.format_exc() print(log_msg.strip()) create_messages_file((err_msg, ), (log_msg, ), output_dir) return 1
def main(): try: args = docopt(__doc__, version=__version__) output_dir = None input_dir, output_dir = get_dirs(args) filenames = [ # every tuple below == (filename, is_optional) ('alternatives.xml', False), ('classes_profiles.xml', True), ('concordance.xml', False), ('counter_veto_crossed.xml', False), ('discordance.xml', False), ('method_parameters.xml', False), ] params = [ 'alternatives', 'categories_profiles', 'comparison_with', 'concordance', 'cv_crossed', 'discordance', 'only_max_discordance', 'with_denominator', ] d = get_input_data(input_dir, filenames, params, use_partials=True) # getting the elements to compare comparables_a = d.alternatives if d.comparison_with in ('boundary_profiles', 'central_profiles'): # central_profiles is a dict, so we need to get the keys comparables_b = [i for i in d.categories_profiles] else: comparables_b = d.alternatives credibility = get_credibility(comparables_a, comparables_b, d.concordance, d.discordance, d.with_denominator, d.only_max_discordance, d.cv_crossed) # serialization etc. if d.comparison_with in ('boundary_profiles', 'central_profiles'): mcda_concept = 'alternativesProfilesComparisons' else: mcda_concept = None comparables = (comparables_a, comparables_b) xmcda = comparisons_to_xmcda(credibility, comparables, mcda_concept=mcda_concept) write_xmcda(xmcda, os.path.join(output_dir, 'credibility.xml')) create_messages_file(None, ('Everything OK.',), output_dir) return 0 except Exception, err: err_msg = get_error_message(err) log_msg = traceback.format_exc() print(log_msg.strip()) create_messages_file((err_msg, ), (log_msg, ), output_dir) return 1
def main(): try: args = docopt(__doc__, version=__version__) input_dir, output_dir = get_dirs(args) input_data = get_input_data(input_dir) concordance = input_data['concordance'] discordances = input_data['discordances'] alternatives = input_data['alternatives'] categories_profiles = input_data['categories_profiles'] credibility = get_credibility(concordance, discordances, alternatives, categories_profiles) xmcda = comparisons_to_xmcda( credibility, mcdaConcept="alternativesProfilesComparisons") write_xmcda(xmcda, os.path.join(output_dir, 'credibility.xml')) create_messages_file(('Everything OK.', ), None, output_dir) return 0 except Exception, err: traceback.print_exc() err_msg = get_error_message(err) create_messages_file(None, (err_msg, ), output_dir) return 1
def main(): try: args = docopt(__doc__, version=__version__) input_dir, output_dir = get_dirs(args) input_data = get_input_data(input_dir) concordance = input_data['concordance'] discordances = input_data['discordances'] alternatives = input_data['alternatives'] categories_profiles = input_data['categories_profiles'] credibility = get_credibility(concordance, discordances, alternatives, categories_profiles) xmcda = comparisons_to_xmcda(credibility, mcdaConcept="alternativesProfilesComparisons") write_xmcda(xmcda, os.path.join(output_dir, 'credibility.xml')) create_messages_file(('Everything OK.',), None, output_dir) return 0 except Exception, err: traceback.print_exc() err_msg = get_error_message(err) create_messages_file(None, (err_msg, ), output_dir) return 1
def main(): try: args = docopt(__doc__, version=__version__) output_dir = None input_dir, output_dir = get_dirs(args) filenames = [ ('method_parameters.xml', False) ] params = [ 'comparison_with' ] d = get_input_data(input_dir, filenames, params) comparison_with = d.comparison_with profilesId = None if comparison_with == "profiles": filenames = [ ('alternatives.xml', False), ('profiles.xml', False), ('criteria.xml', False), ('weights.xml', False), ('discordance.xml', False), ] params = [ 'alternatives', 'profiles', 'criteria', 'weights', 'discordance', ] kwargs = {'use_partials': True, 'comparison_with': comparison_with} d = get_input_data(input_dir, filenames, params, **kwargs) profilesId = d.profiles alternativesId = d.alternatives criteriaId = d.criteria weights = d.weights discordance = d.discordance else: filenames = [ ('alternatives.xml', False), ('criteria.xml', False), ('weights.xml', False), ('discordance.xml', False), ] params = [ 'alternatives', 'criteria', 'weights', 'discordance', ] kwargs = {'use_partials': True} d = get_input_data(input_dir, filenames, params, **kwargs) alternativesId = d.alternatives criteriaId = d.criteria weights = d.weights discordance = d.discordance alg = algorithm(alternativesId, profilesId, criteriaId, weights, discordance) result = alg.Run() if profilesId == None: comparables = (alternativesId, alternativesId) xmcda = comparisons_to_xmcda(result, comparables, None) write_xmcda(xmcda, os.path.join(output_dir, 'discordance.xml')) create_messages_file(None, ('Everything OK.',), output_dir) else: comparables = (alternativesId, profilesId) xmcda = comparisons_to_xmcda(result, comparables, None, with_profile = True) write_xmcda(xmcda, os.path.join(output_dir, 'discordance.xml')) create_messages_file(None, ('Everything OK.',), output_dir) return 0 except Exception, err: err_msg = get_error_message(err) log_msg = traceback.format_exc() print(log_msg.strip()) create_messages_file((err_msg, ), (log_msg, ), output_dir) return 1