Пример #1
0
	virtual void add_parameter(string const& key, ArgSource& args) {
		if (key == "out") {
			output_file = args.get_string_argument();
		} else if (key == "quiet") {
			quiet = true;
		} else {
			LsoMainFunction::add_parameter(key,args);
		}
	}
Пример #2
0
	virtual void add_parameter(string const& key, ArgSource& args) {
		if (key == "out") {
			output_file = args.get_string_argument();
		} else if (key == "quiet") {
			quiet = true;
		} else if (key == "numeric") {
			static_cast<ParamSourceCommandline&>(args).graph_node_type = GRAPH_INT;
		} else {
			LsoMainFunction::add_parameter(key,args);
		}
	}
Пример #3
0
	virtual void add_parameter(string const& key, ArgSource& args) {
		if (key == "loss" || key == "lossfun" || key == "objective") {
			vector<double> more;
			string lossname = args.get_string_argument(&more);
			lossfun = loss_function_by_name(lossname, more.size(), &more[0]);
		} else if (key == "loss_extra" || key == "extra_loss" || key == "extra_loss_self") {
			double extra = args.get_double_argument();
			lossfun = shared_ptr<LossFunction>(new ExtraSelf(lossfun,extra));
		} else if (key == "extra_loss_num") {
			double extra = args.get_double_argument();
			lossfun = shared_ptr<LossFunction>(new ExtraNum(lossfun,extra));
		} else if (key == "extra_no_singleton") {
			double amount = args.get_double_argument();
			lossfun = shared_ptr<LossFunction>(new ExtraNoSingleton(lossfun,amount));
		} else if (key == "total_volume") {
			double vol = args.get_double_argument();
			lossfun = shared_ptr<LossFunction>(new WithTotalVolume(lossfun,vol));
			
		} else if (key == "init" || key == "initial") {
			clustering = args.get_1dvec_argument();
		} else if (key == "eval" || key == "evaluate") {
			clustering = args.get_1dvec_argument();
			optimize = false;
		
		} else if (key == "max_clusters" || key == "max_cluster" || key == "max_num_clusters" || key == "max_num_cluster") {
			params.max_num_clusters = args.get_int_argument();
		} else if (key == "min_clusters" || key == "min_cluster" || key == "min_num_clusters" || key == "min_num_cluster") {
			params.min_num_clusters = args.get_int_argument();
		} else if (key == "num_clusters" || key == "num_cluster") {
			params.max_num_clusters = params.min_num_clusters = args.get_int_argument();
		
		} else if (key == "verbose" || key == "verbosity") {
			params.verbosity = args.get_int_argument();
		} else if (key == "check_invariants" || key == "check" || key == "check_loss") {
			params.check_invariants = args.get_bool_argument();
		} else if (key == "num_repeats" || key == "num_repeat" || key == "repeats") {
			params.num_repeats = args.get_int_argument();
		} else if (key == "num_loss_tweak" || key == "num_loss_tweak_iterations" || key == "loss_tweak_iterations") {
			params.num_loss_tweak_iterations = args.get_int_argument();
		} else if (key == "num_partitions" || key == "num_partition" || key == "partition") {
			params.num_partitions = args.get_int_argument();
		} else if (key == "always_consider_empty" || key == "consider_empty") {
			params.always_consider_empty = args.get_bool_argument();
		} else if (key == "optimize_after_higher_level") {
			params.optimize_after_higher_level = args.get_bool_argument();
		} else if (key == "optimize_higher_level") {
			params.optimize_higher_level = args.get_bool_argument();
		} else if (key == "optimize_only_num_cluster" || key == "optimize_num_clusters_with_outer_loop") {
			params.optimize_num_clusters_with_outer_loop = args.get_bool_argument();
		} else if (key == "optimize_globally_best_moves" || key == "optimize_globally_best_move") {
			params.optimize_globally_best_moves = args.get_bool_argument();
		} else if (key == "seed") {
			seed = args.get_int_argument();
		
		} else if (key == "trace_file") {
			params.trace_out = &trace;
			trace_file = args.get_string_argument();
		
		} else {
			throw std::invalid_argument("Unrecognized key: " + key);
		}
	}