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'] 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'] 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.xml', False), ('classes_profiles.xml', False), ('flows.xml', False), ] params = [ 'alternatives', 'categories', 'alternatives_flows', 'categories_flows', 'categories_rank', 'profiles_categories' ] d = get_input_data(input_dir, filenames, params, comparison_with='central_profiles') assignments = sortPrometheeTri(d.alternatives, d.categories, d.profiles_categories, d.alternatives_flows, d.categories_flows) xmcda_assign = assignments_to_xmcda(assignments) write_xmcda(xmcda_assign, os.path.join(output_dir, 'assignments.xml')) except Exception as 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) alternatives = input_data['alternatives'] cut_threshold = input_data['cut_threshold'] eliminate_cycles_method = input_data['eliminate_cycles_method'] outranking = input_data['outranking'] graph = build_graph(alternatives, outranking, cut_threshold) # because of the 'eliminate_cycles' routine used by 'find_kernel, a graph # is returned with the kernel which allows for further examination kernel, graph = find_kernel(graph, eliminate_cycles_method) kernel_as_labels = get_kernel_as_labels(kernel, graph) xmcda = kernel_to_xmcda(kernel_as_labels) write_xmcda(xmcda, os.path.join(output_dir, 'kernel.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'] categories_rank = input_data['categories_rank'] credibility = input_data['credibility'] cut_threshold = input_data['cut_threshold'] affectations = assign_class(alternatives, categories_profiles, categories_rank, credibility, cut_threshold) affectations_xmcda = affectations_to_xmcda(affectations) write_xmcda(affectations_xmcda, os.path.join(output_dir, 'affectations.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'] cut_threshold = input_data['cut_threshold'] eliminate_cycles_method = input_data['eliminate_cycles_method'] outranking = input_data['outranking'] graph = build_graph(alternatives, outranking, cut_threshold) # because of the 'eliminate_cycles' routine used by 'find_kernel, a graph # is returned with the kernel which allows for further examination kernel, graph = find_kernel(graph, eliminate_cycles_method) kernel_as_labels = get_kernel_as_labels(kernel, graph) xmcda = kernel_to_xmcda(kernel_as_labels) write_xmcda(xmcda, os.path.join(output_dir, 'kernel.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'] criteria = input_data['criteria'] pref_directions = input_data['pref_directions'] thresholds = input_data['thresholds'] performances = input_data['performances'] discordances = get_discordances(alternatives, criteria, pref_directions, thresholds, performances) aggregated_discordances = aggregate_discordances(discordances) xmcda = aggregated_discordances_to_xmcda(aggregated_discordances) write_xmcda(xmcda, os.path.join(output_dir, 'discordance_binary.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__) output_dir = None input_dir, output_dir = get_dirs(args) filenames = [ # every tuple below == (filename, is_optional) ('alternatives.xml', False), ('classes.xml', False), ('classes_profiles.xml', False), ('method_parameters.xml', False), ('positive_flows.xml', False), ('negative_flows.xml', False), ] params = [ 'alternatives', 'categories', 'alternatives_positive_flows', 'alternatives_negative_flows', 'categories_positive_flows', 'categories_negative_flows', 'categories_rank', 'profiles_categories', 'cut_point' ] d = get_input_data(input_dir, filenames, params, comparison_with='boundary_profiles') output = sortPromsort(d.alternatives, d.categories, d.profiles_categories, d.alternatives_positive_flows, d.alternatives_negative_flows, d.categories_positive_flows, d.categories_negative_flows, d.cut_point) #print (output) #print (output[0]) assignments = output[0] first_step_assignments = output[1] xmcda_assign = assignments_to_xmcda(assignments) xmcda_first_step_assign = assignments_as_intervals_to_xmcda( first_step_assignments) write_xmcda(xmcda_assign, os.path.join(output_dir, 'assignments.xml')) write_xmcda(xmcda_first_step_assign, os.path.join(output_dir, 'first_step_assignments.xml')) except Exception as 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.xml', False), ('classes_profiles.xml', False), ('method_parameters.xml', False), ('flows.xml', False), ] params = [ 'alternatives', 'categories', 'comparison_with', 'alternatives_flows', 'categories_flows', 'categories_rank', 'profiles_categories' ] d = get_input_data(input_dir, filenames, params) if d.comparison_with == 'boundary_profiles': assignments = sortWithBoundaryProfiles(d.alternatives, d.categories, d.profiles_categories, d.alternatives_flows, d.categories_flows) xmcda_assign = assignments_to_xmcda(assignments) elif d.comparison_with == 'central_profiles': assignments = sortWithCentralProfiles(d.alternatives, d.categories, d.profiles_categories, d.alternatives_flows, d.categories_flows) xmcda_assign = assignments_to_xmcda(assignments) else: raise InputDataError( "Wrong comparison type ('{}') specified.".format( comparison_with)) write_xmcda(xmcda_assign, os.path.join(output_dir, 'assignments.xml')) except Exception as 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.xml', False), ('classes_profiles.xml', False), ('outranking.xml', False), ] params = [ 'alternatives', 'categories_profiles', 'categories_rank', 'outranking', ] d = get_input_data(input_dir, filenames, params, comparison_with='boundary_profiles') assignments = assign_class(d.alternatives, d.categories_rank, d.categories_profiles, d.outranking) # uncomment this if you want output combined as a single file (and # remember to import assignments_as_intervals_to_xmcda): # xmcda_intervals = assignments_as_intervals_to_xmcda(assignments) # write_xmcda(xmcda_intervals, # os.path.join(output_dir, 'assignments_intervals.xml')) assignments_con = {i[0]: i[1][0] for i in assignments.iteritems()} xmcda_con = assignments_to_xmcda(assignments_con) write_xmcda(xmcda_con, os.path.join(output_dir, 'assignments_conjuctive.xml')) assignments_dis = {i[0]: i[1][1] for i in assignments.iteritems()} xmcda_dis = assignments_to_xmcda(assignments_dis) write_xmcda(xmcda_dis, os.path.join(output_dir, 'assignments_disjunctive.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 = [ ('alternatives.xml', False), ('outranking.xml', False), ('preorder.xml', True), ('method_parameters.xml', True), ] params = [ 'alternatives', 'outranking', 'preorder', 'direction', ] d = get_input_data(input_dir, filenames, params) alternatives = d.alternatives preorder = None if (d.preorder is not None): preorder = d.preorder outranking = d.outranking direction = d.direction alg = algorithm(alternatives, outranking, preorder, direction) result = alg.Run() xmcda = ranks_to_xmcda(result, 'integer', None) write_xmcda(xmcda, os.path.join(output_dir, 'ranking.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 = [ ('alternatives.xml', False), ('credibility.xml', False), ('method_parameters.xml', True), ] params = [ 'alternatives', 'credibility', 'direction', 'alpha', 'beta' ] d = get_input_data(input_dir, filenames, params) alternativesId = d.alternatives credibility = d.credibility direction = d.direction alpha = d.alpha beta = d.beta alg = algorithm(alternativesId, credibility, direction, alpha, beta) result = alg.Run() xmcda = ranks_to_xmcda(result, 'integer', None) write_xmcda(xmcda, os.path.join(output_dir, 'ranking.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.xml', False), ('classes_profiles.xml', False), ('credibility.xml', False), ('outranking.xml', False), ] params = [ 'alternatives', 'categories_profiles', 'categories_rank', 'credibility', 'outranking', ] d = get_input_data(input_dir, filenames, params, comparison_with='central_profiles') assignments = assign_class(d.alternatives, d.categories_rank, d.categories_profiles, d.outranking, d.credibility) # serialization etc. xmcda_assign = assignments_as_intervals_to_xmcda(assignments) write_xmcda(xmcda_assign, os.path.join(output_dir, 'assignments.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.xml', False), ('classes_profiles.xml', False), ('credibility.xml', False), ('outranking.xml', False), ] params = [ 'alternatives', 'categories_profiles', 'categories_rank', 'credibility', 'outranking', ] d = get_input_data(input_dir, filenames, params, comparison_with='central_profiles') assignments = assign_class(d.alternatives, d.categories_rank, d.categories_profiles, d.outranking, d.credibility) # serialization etc. xmcda_assign = assignments_as_intervals_to_xmcda(assignments) write_xmcda(xmcda_assign, os.path.join(output_dir, 'assignments.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) performances = input_data['performances'] criteria = input_data['criteria'] thresholds = input_data['thresholds'] pref_directions = input_data['pref_directions'] credibility = get_credibility(performances, criteria, thresholds, pref_directions) xmcda = credibility_to_xmcda(credibility) 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) alternatives = input_data['alternatives'] concordance = input_data['concordance'] discordance_binary = input_data['discordance_binary'] cut_threshold = input_data['cut_threshold'] outranking_binary = get_outranking_binary(alternatives, concordance, discordance_binary, cut_threshold) xmcda = outranking_binary_to_xmcda(outranking_binary) write_xmcda(xmcda, os.path.join(output_dir, 'outranking_binary.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), ('credibility.xml', True), ('method_parameters.xml', False), ('outranking.xml', False), ] params = [ 'alternatives', 'credibility', 'eliminate_cycles_method', 'outranking', ] d = get_input_data(input_dir, filenames, params) graph = build_graph(d.alternatives, d.outranking, d.credibility) # because of the 'eliminate_cycles' routine used by 'find_kernel, # a graph is returned with the kernel which allows for further # examination / debugging kernel, graph_without_cycles = find_kernel(graph, d.eliminate_cycles_method) kernel_as_labels = get_kernel_as_labels(kernel, graph_without_cycles) xmcda = kernel_to_xmcda(kernel_as_labels) write_xmcda(xmcda, os.path.join(output_dir, 'kernel.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) alternatives = input_data['alternatives'] categories_profiles = input_data['categories_profiles'] categories_rank = input_data['categories_rank'] credibility = input_data['credibility'] cut_threshold = input_data['cut_threshold'] affectations = assign_class(alternatives, categories_profiles, categories_rank, credibility, cut_threshold) affectations_xmcda = affectations_to_xmcda(affectations) write_xmcda(affectations_xmcda, os.path.join(output_dir, 'affectations.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__) input_dir, output_dir = get_dirs(args) input_data = get_input_data(input_dir) alternatives = input_data['alternatives'] concordance = input_data['concordance'] discordance_binary = input_data['discordance_binary'] cut_threshold = input_data['cut_threshold'] outranking_binary = get_outranking_binary(alternatives, concordance, discordance_binary, cut_threshold) xmcda = outranking_binary_to_xmcda(outranking_binary) write_xmcda(xmcda, os.path.join(output_dir, 'outranking_binary.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 = [ ('alternatives.xml', False), ('outranking.xml', False), ('nonoutranking.xml', True), ('method_parameters.xml', False), ] params = [ 'alternatives', 'outranking', 'nonoutranking', 'crisp_outranking' ] d = get_input_data(input_dir, filenames, params) alternativesId = d.alternatives outranking = d.outranking nonoutranking = d.nonoutranking crisp_outranking = d.crisp_outranking alg = algorithm(alternativesId, outranking, nonoutranking, crisp_outranking) result = alg.Run() type = 'real' if crisp_outranking == "true": type = 'integer' xmcda = ranks_to_xmcda(result[0], type, None) write_xmcda(xmcda, os.path.join(output_dir, 'nfs.xml')) xmcda = ranks_to_xmcda(result[1], type, None) write_xmcda(xmcda, os.path.join(output_dir, 'strength.xml')) xmcda = ranks_to_xmcda(result[2], type, None) write_xmcda(xmcda, os.path.join(output_dir, 'weakness.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 = [ ('alternatives.xml', False), ('downwards.xml', False), ('upwards.xml', False), ] params = [ 'alternatives', 'downwards', 'upwards', ] d = get_input_data(input_dir, filenames, params) alternativesId = d.alternatives downwards = d.downwards upwards = d.upwards alg = algorithm(alternativesId, downwards, upwards) result = alg.Run() comparables = (alternativesId, alternativesId) #xmcda = comparisons_to_xmcda(result[0], comparables) xmcda = outranking_to_xmcda(result[0]) write_xmcda(xmcda, os.path.join(output_dir, 'intersection.xml')) xmcda = ranks_to_xmcda(result[1], 'integer', None) write_xmcda(xmcda, os.path.join(output_dir, 'rank.xml')) xmcda = ranks_to_xmcda(result[2], 'integer', None) write_xmcda(xmcda, os.path.join(output_dir, 'median.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 = [ ('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