algo = MipMRSort while options.random_model_type != "default" \ and options.random_model_type != "choquet": print("1. Default MR-Sort model") print("2. Choquet MR-Sort model") i = raw_input("Type of random model to initialize? ") if i == '1': options.random_model_type = 'default' elif i == '2': options.random_model_type = 'choquet' random_model_type = options.random_model_type options.na = read_multiple_integer(options.na, "Number of assignment examples") options.nc = read_multiple_integer(options.nc, "Number of criteria") options.ncat = read_multiple_integer(options.ncat, "Number of categories") options.na_gen = read_multiple_integer(options.na_gen, "Number of " \ "generalization alternatives") options.pcerrors = read_multiple_integer(options.pcerrors, "Percentage " \ "of errors") options.nseeds = read_single_integer(options.nseeds, "Number of seeds") dt = datetime.datetime.now().strftime("%Y%m%d-%H%M%S") default_filename = "%s/test_%s-%s.csv" % (DATADIR, algo.__name__, dt) options.filename = read_csv_filename(options.filename, default_filename) directory = options.filename + "-data" if not os.path.exists(directory): os.makedirs(directory)
parser.add_option("-s", "--nseeds", action="store", type="string", dest="nseeds", help="number of seeds") parser.add_option("-f", "--filename", action="store", type="string", dest="filename", help="filename to save csv output") (options, args) = parser.parse_args() options.na = read_multiple_integer(options.na, "Number of " \ "assignment examples") options.nc = read_multiple_integer(options.nc, "Number of criteria") options.ncat = read_multiple_integer(options.ncat, "Number of " \ "categories") options.na_gen = read_multiple_integer(options.na_gen, "Number of " \ "generalization alternatives") options.pcerrors = read_multiple_integer(options.pcerrors, "Ratio of errors") options.nseeds = read_single_integer(options.nseeds, "Number of seeds") options.ns = read_multiple_integer(options.ns, "Number of function " \ "segments") dt = datetime.datetime.now().strftime("%Y%m%d-%H%M%S") default_filename = "%s/test_lp_avfsort-%s.csv" % (DATADIR, dt) options.filename = read_csv_filename(options.filename, default_filename)
parser.add_option("-f", "--filename", action="store", type="string", dest="filename", help="filename to save csv output") (options, args) = parser.parse_args() while not options.csvfile: options.csvfile = raw_input("CSV file containing data ? ") data = load_mcda_input_data(options.csvfile) if data is None: exit(1) options.pclearning = read_multiple_integer(options.pclearning, "Percentage of data to " \ "use in the learning set") options.nseeds = read_single_integer(options.nseeds, "Number of seeds") dt = datetime.datetime.now().strftime("%Y%m%d-%H%M%S") default_filename = "%s/test_mip_mrsort-%s-%s.csv" \ % (DATADIR, data.name, dt) options.filename = read_csv_filename(options.filename, default_filename) directory = options.filename + "-data" if not os.path.exists(directory): os.makedirs(directory) run_tests(options.nseeds, data, options.pclearning, options.filename) print("Results saved in '%s'" % options.filename)
print("2. PROPORTIONAL veto") i = raw_input("What mode of veto? ") if i == '1': options.vetom = 'absolute' elif i == '2': options.vetom = 'proportional' vetom = options.vetom if vetom == 'absolute': veto_func = 1 elif vetom == 'proportional': veto_func = 2 options.vparam = read_multiple_float(options.vparam, "Value of the veto param") options.na = read_multiple_integer(options.na, "Number of assignment examples") options.nc = read_multiple_integer(options.nc, "Number of criteria") options.ncat = read_multiple_integer(options.ncat, "Number of categories") options.na_gen = read_multiple_integer(options.na_gen, "Number of " \ "generalization alternatives") options.pcerrors = read_multiple_integer(options.pcerrors, "Ratio of " \ "errors") options.nseeds = read_single_integer(options.nseeds, "Number of seeds") dt = datetime.datetime.now().strftime("%Y%m%d-%H%M%S") default_filename = "%s/test_%s-%s.csv" % (DATADIR, "mip_mrsort_veto", dt) options.filename = read_csv_filename(options.filename, default_filename) directory = "%s/test_%s-%s" % (DATADIR, "mip_mrsort_veto", dt) if not os.path.exists(directory): os.makedirs(directory)
dest="filename", help="filename to save csv output") (options, args) = parser.parse_args() while not options.csvfile: options.csvfile = raw_input("CSV file containing data ? ") data = load_mcda_input_data(options.csvfile) if data is None: exit(1) if options.choquet is True: lp_weights = LpMRSortMobius heur_profiles = MetaMRSortProfilesChoquet options.pclearning = read_multiple_integer(options.pclearning, "Percentage of data to " \ "use in the learning set") options.max_oloops = read_multiple_integer(options.max_oloops, "Max " \ "number of loops for " \ "profiles' metaheuristic") options.nmodels = read_multiple_integer(options.nmodels, "Population size (models)") options.max_loops = read_multiple_integer(options.max_loops, "Max " \ "number of loops for the " \ "whole metaheuristic") options.nseeds = read_single_integer(options.nseeds, "Number of seeds") dt = datetime.datetime.now().strftime("%Y%m%d-%H%M%S") default_filename = "%s/test_meta_mrsort3-%s-%s.csv" \ % (DATADIR, data.name, dt) options.filename = read_csv_filename(options.filename, default_filename)
parser.add_option("-s", "--nseeds", action = "store", type="string", dest = "nseeds", help = "number of seeds") parser.add_option("-f", "--filename", action = "store", type="string", dest = "filename", help = "filename to save csv output") (options, args) = parser.parse_args() while not options.csvfile: options.csvfile = raw_input("CSV file containing data ? ") data = load_mcda_input_data(options.csvfile) if data is None: exit(1) options.pclearning = read_multiple_integer(options.pclearning, "Percentage of data to " \ "use in the learning set") options.nseeds = read_single_integer(options.nseeds, "Number of seeds") dt = datetime.datetime.now().strftime("%Y%m%d-%H%M%S") default_filename = "%s/test_mip_mrsort-%s-%s.csv" \ % (DATADIR, data.name, dt) options.filename = read_csv_filename(options.filename, default_filename) directory = options.filename + "-data" if not os.path.exists(directory): os.makedirs(directory) run_tests(options.nseeds, data, options.pclearning, options.filename) print("Results saved in '%s'" % options.filename)
parser.add_option("-o", "--max_oloops", action = "store", type="string", dest = "max_oloops", help = "max number of loops for the metaheuristic " \ "used to find the profiles") parser.add_option("-f", "--filename", action="store", type="string", dest="filename", help="filename to save csv output") (options, args) = parser.parse_args() algo = MetaMRSortPop3 options.na = read_multiple_integer(options.na, "Number of assignment examples") options.nc = read_multiple_integer(options.nc, "Number of criteria") options.ncat = read_multiple_integer(options.ncat, "Number of categories") options.ns = read_multiple_integer(options.ns, "Number of function " \ "segments") options.na_gen = read_multiple_integer(options.na_gen, "Number of " \ "generalization alternatives") options.pcerrors = read_multiple_integer(options.pcerrors, "Ratio of " \ "errors") options.max_oloops = read_multiple_integer(options.max_loops, "Max " \ "number of loops for " \ "profiles' metaheuristic") options.nmodels = read_multiple_integer(options.nmodels, "Population size (models)") options.max_loops = read_multiple_integer(options.max_loops, "Max " \ "number of loops for the " \
parser.add_option("-s", "--nseeds", action = "store", type="string", dest = "nseeds", help = "number of seeds") parser.add_option("-f", "--filename", action = "store", type="string", dest = "filename", help = "filename to save csv output") (options, args) = parser.parse_args() while not options.csvfile: options.csvfile = raw_input("CSV file containing data ? ") data = load_mcda_input_data(options.csvfile) if data is None: exit(1) options.pclearning = read_multiple_integer(options.pclearning, "Percentage of data to " \ "use in the learning set") options.ns = read_multiple_integer(options.ns, "Number of function " \ "segments") options.nseeds = read_single_integer(options.nseeds, "Number of seeds") dt = datetime.datetime.now().strftime("%Y%m%d-%H%M%S") default_filename = "%s/test_lp_avfsort-%s-%s.csv" \ % (DATADIR, data.name, dt) options.filename = read_csv_filename(options.filename, default_filename) directory = options.filename + "-data" if not os.path.exists(directory): os.makedirs(directory) run_tests(options.nseeds, data, options.pclearning, options.ns,
dest = "filename", help = "filename to save csv output") (options, args) = parser.parse_args() while not options.csvfile: options.csvfile = raw_input("CSV file containing data ? ") data = load_mcda_input_data(options.csvfile) if data is None: exit(1) if options.choquet is True: lp_weights = LpMRSortMobius heur_profiles = MetaMRSortProfilesChoquet options.pclearning = read_multiple_integer(options.pclearning, "Percentage of data to " \ "use in the learning set") options.max_oloops = read_multiple_integer(options.max_oloops, "Max " \ "number of loops for " \ "profiles' metaheuristic") options.nmodels = read_multiple_integer(options.nmodels, "Population size (models)") options.max_loops = read_multiple_integer(options.max_loops, "Max " \ "number of loops for the " \ "whole metaheuristic") options.nseeds = read_single_integer(options.nseeds, "Number of seeds") dt = datetime.datetime.now().strftime("%Y%m%d-%H%M%S") default_filename = "%s/test_meta_mrsort2-%s-%s.csv" \ % (DATADIR, data.name, dt) options.filename = read_csv_filename(options.filename, default_filename)
parser.add_option("-m", "--nmodels", action = "store", type="string", dest = "nmodels", help = "Size of the population (of models)") parser.add_option("-o", "--max_oloops", action = "store", type="string", dest = "max_oloops", help = "max number of loops for the metaheuristic " \ "used to find the profiles") parser.add_option("-f", "--filename", action = "store", type="string", dest = "filename", help = "filename to save csv output") (options, args) = parser.parse_args() algo = MetaMRSortPop3 options.na = read_multiple_integer(options.na, "Number of assignment examples") options.nc = read_multiple_integer(options.nc, "Number of criteria") options.ncat = read_multiple_integer(options.ncat, "Number of categories") options.ns = read_multiple_integer(options.ns, "Number of function " \ "segments") options.na_gen = read_multiple_integer(options.na_gen, "Number of " \ "generalization alternatives") options.pcerrors = read_multiple_integer(options.pcerrors, "Ratio of " \ "errors") options.max_oloops = read_multiple_integer(options.max_loops, "Max " \ "number of loops for " \ "profiles' metaheuristic") options.nmodels = read_multiple_integer(options.nmodels, "Population size (models)") options.max_loops = read_multiple_integer(options.max_loops, "Max " \ "number of loops for the " \
options.third = True elif i == '4': options.fourth = True i = 0 if options.third is True: algo = MetaMRSortProfiles3 i += 1 if options.fourth is True: algo = MetaMRSortProfiles4 i += 1 if i > 1: print("Cannot select multiple algorithms at the same time") sys.exit(1) options.na = read_multiple_integer(options.na, "Number of " \ "assignment examples") options.nc = read_multiple_integer(options.nc, "Number of criteria") options.ncat = read_multiple_integer(options.ncat, "Number of " \ "categories") options.na_gen = read_multiple_integer(options.na_gen, "Number of " \ "generalization alternatives") options.pcerrors = read_multiple_integer(options.pcerrors, "Ratio of errors") options.max_loops = read_multiple_integer(options.max_loops, "Max number of loops") options.nseeds = read_single_integer(options.nseeds, "Number of seeds") dt = datetime.datetime.now().strftime("%Y%m%d-%H%M%S") default_filename = "%s/test_%s-%s.csv" \ % (DATADIR, algo.__name__, dt) options.filename = read_csv_filename(options.filename, default_filename)