Exemple #1
0
static const string * readstring(FormatState * fs){
	unsigned char c = current();
	if (c == '\"') {
		while (fs->curpos < fs->len) {
			c = next();
			if (c == '\"' && lookback() != '\\') {
				break;
			}
		}
	} else if (c == '\'') {
		while (fs->curpos < fs->len) {
			c = next();
			if (c == '\'' && lookback() != '\\') {
				break;
			}
		}
	} else {
		//[[
		while (fs->curpos < fs->len) {
			c = next();
			if (c == ']') {
				if (peek() == ']') {
					break;
				}
			}
		}
	}
	
	return split(fs, String);
}
Exemple #2
0
int main(void){
	float lookback(float z);
 	float redshift,time;

	printf("Please input the redshift:\n");
	scanf("%f",&redshift);
	time=lookback(redshift);
	printf("The lookback time is %f Gyr\n",time);

	return(0);

}
Exemple #3
0
/////////////////////////////////////////////////////////////////////////////////////////
// Clasp specific search options
/////////////////////////////////////////////////////////////////////////////////////////
void SearchOptions::initOptions(ProgramOptions::OptionGroup& root, ProgramOptions::OptionGroup& hidden) {
	OptionGroup search("Clasp - Search Options");
	search.addOptions()
                /*("lookahead"  , storeTo(config->heuristic.lookahead)->setImplicit(),
			"Configure failed-literal detection (fld)\n"
			"      Default: no (atom, if --nolookback)\n"
			"      Valid:   atom, body, hybrid, no\n"
			"        atom  : Apply failed-literal detection to atoms\n"
			"        body  : Apply failed-literal detection to bodies\n"
			"        hybrid: Apply Nomore++-like failed-literal detection\n"
                        "        no    : Do not apply failed-literal detection", "<arg>")*/
		("initial-lookahead", storeTo(config->heuristic.lookaheadNum), "Restrict fld to <n> decisions\n", "<n>")

		("heuristic", storeTo(config->heuristic.heuristic)->parser(SearchOptions::mapHeuristic), 
			"Configure decision heuristic\n"
			"      Default: Berkmin (Unit, if --no-lookback)\n"
			"      Valid:   Berkmin, Vmtf, Vsids, Unit, None\n"
			"        Berkmin: Apply BerkMin-like heuristic\n"
			"        Vmtf   : Apply Siege-like heuristic\n"
			"        Vsids  : Apply Chaff-like heuristic\n"
			"        Unit   : Apply Smodels-like heuristic\n"
			"        None   : Select the first free variable")
		("rand-freq", storeTo(parseSolve)->parser(&SolveOptionsWrapper::mapRandFreq), 
			"Make random decisions with probability <p>\n"
			"      Default: 0.0\n"
			"      Valid:   [0.0...1.0]\n", "<p>")

		("rand-prob", storeTo(parseSolve)->parser(&SolveOptionsWrapper::mapRandProb)->setImplicit(),
			"Configure random probing\n"
			"      Default: no\n"
			"      Valid:   yes, no, <n1,n2> (<n1> >= 0, <n2> > 0)\n"
			"        yes    : Run 50 random passes up to at most 20 conflicts each\n"
			"        no     : Do not run random probing\n"
			"        <n1,n2>: Run <n1> random passes up to at most <n2> conflicts each\n", "<opts>")

		("rand-watches", bool_switch()->defaultValue(true),
			"Configure watched literal initialization\n"
			"      Default: yes\n"
			"      Valid:   yes, no\n"
			"        yes: Randomly determine watched literals\n"
			"        no : Watch first and last literal in a nogood\n")
	;
	
	OptionGroup lookback("Clasp - Lookback Options");
	lookback.addOptions()
                //("no-lookback"   ,bool_switch(), "Disable all lookback strategies\n")

		("restarts,r", storeTo(parseSolve)->parser(&SolveOptionsWrapper::mapRestarts),
			"Configure restart policy\n"
			"      Default: 100,1.5\n"
			"      Valid:   <n1[,n2,n3]> (<n1> >= 0, <n2>,<n3> > 0), no\n"
			"        <n1>          : Run Luby et al.'s sequence with unit length <n1>\n"
			"        <n1>,<n2>     : Run geometric sequence of <n1>*(<n2>^i) conflicts\n"
			"        <n1>,<n2>,<n3>: Run Biere's inner-outer geometric sequence (<n3>=outer)\n"
			"        <n1> = 0, no  : Disable restarts")
		("local-restarts"  , bool_switch(&config->solve.restart.local), "Enable Ryvchin et al.'s local restarts")
		("bounded-restarts", bool_switch(&config->solve.restart.bounded), "Enable (bounded) restarts during model enumeration")
		("reset-restarts",   bool_switch(&config->solve.restart.resetOnModel), "Reset restart strategy during model enumeration")
		("save-progress"   , storeTo(solverOpts)->setImplicit()->parser(&SolverStrategiesWrapper::mapSaveProg), "Enable RSat-like progress saving on backjumps > <n>\n", "<n>")

		("shuffle,s", storeTo(parseSolve)->parser(&SolveOptionsWrapper::mapShuffle),
			"Configure shuffling after restarts\n"
			"      Default: 0,0\n"
			"      Valid:   <n1,n2> (<n1> >= 0, <n2> >= 0)\n"
			"        <n1> > 0: Shuffle problem after <n1> and re-shuffle every <n2> restarts\n"
			"        <n1> = 0: Do not shuffle problem after restarts\n"
			"        <n2> = 0: Do not re-shuffle problem\n", "<n1,n2>")

		("deletion,d", storeTo(parseSolve)->parser(&SolveOptionsWrapper::mapReduce), 
			"Configure size of learnt nogood database\n"
			"      Default: 3.0,1.1,3.0\n"
			"      Valid:   <n1[,n2,n3]> (<n3> >= <n1> >= 0, <n2> >= 1.0), no\n"
			"        <n1,n2,n3>: Store at most min(P/<n1>*(<n2>^i),P*<n3>) learnt nogoods,\n"
			"                    P and i being initial problem size and number of restarts\n"
			"        no        : Do not delete learnt nogoods")
		("reduce-on-restart", bool_switch(&config->solve.reduce.reduceOnRestart), "Delete some learnt nogoods after every restart\n")
		("estimate", bool_switch(&config->solve.reduce.estimate), "Use estimated problem complexity to init learnt db\n")

		("strengthen", storeTo(solverOpts)->parser(&SolverStrategiesWrapper::mapStrengthen),
			"Configure conflict nogood strengthening\n"
			"      Default: all\n"
			"      Valid:   bin, tern, all, no\n"
			"        bin : Check only binary antecedents for self-subsumption\n"
			"        tern: Check binary and ternary antecedents for self-subsumption\n"
			"        all : Check all antecedents for self-subsumption\n"
			"        no  : Do not check antecedents for self-subsumption")
		("recursive-str", bool_switch(&solverOpts.opts->strengthenRecursive), "Enable MiniSAT-like conflict nogood strengthening\n")

		("loops", storeTo(config->api.loopRep),
			"Configure representation and learning of loop formulas\n"
			"      Default: common\n"
			"      Valid:   common, distinct, shared, no\n"
			"        common  : Create loop nogoods for atoms in an unfounded set\n"
			"        distinct: Create distinct loop nogood for each atom in an unfounded set\n"
			"        shared  : Create loop formula for a whole unfounded set\n"
			"        no      : Do not learn loop formulas\n")

		("contraction", storeTo(solverOpts)->parser(&SolverStrategiesWrapper::mapContract),
			"Configure (temporary) contraction of learnt nogoods\n"
			"      Default: 250\n"
			"      Valid:\n"
			"        0  : Do not contract learnt nogoods\n"
			"        > 0: Contract learnt nogoods containing more than <num> literals\n", "<num>")
	;

	hidden.addOptions()
		("loops-in-heu", storeTo(config->heuristic.loops), "Consider loop nogoods in heuristic")
		("berk-max", storeTo(config->heuristic.extra.berkMax), "Consider at most <n> nogoods in Berkmin")
		("berk-moms", bool_switch(&config->heuristic.berkMoms), "Enable/Disable MOMs in Berkmin")
		("berk-huang",bool_switch(&config->heuristic.berkHuang), "Enable/Disable Huang-scoring in Berkmin")
		("vmtf-mtf",storeTo(config->heuristic.extra.vmtfMtf), "In Vmtf move up to <n> conflict-literals to the front")
		("nant",bool_switch(&config->heuristic.nant), "In Unit count only atoms in NAnt(P)")
	;
	root.addOptions(search);
	root.addOptions(lookback);
}