Skip to content

Commit 5dfda05

Browse files
committed
Added CEGIS danger option for genetic only.
1 parent 77293f1 commit 5dfda05

File tree

4 files changed

+18
-16
lines changed

4 files changed

+18
-16
lines changed

src/cegis/danger/facade/danger_runner.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -107,28 +107,28 @@ int run_match(mstreamt &os, optionst &opt, const danger_programt &prog,
107107
typedef ga_learnt<selectt, mutatet, crosst, fitnesst, danger_fitness_configt> ga_learnt;
108108
ga_learnt ga_learn(opt, rnd, select, mutate, cross, fitness, converter);
109109
#ifndef _WIN32
110-
concurrent_learnt<ga_learnt, symex_learnt> learn(ga_learn, symex_learn,
111-
serialise, std::ref(deser), deserialise, symex_head_start);
112-
#else
113-
// TODO: Remove once task_pool supports Windows.
114-
ga_learnt &learn=ga_learn;
110+
if (!opt.get_bool_option(CEGIS_GENETIC_ONLY))
111+
{
112+
concurrent_learnt<ga_learnt, symex_learnt> learn(ga_learn, symex_learn,
113+
serialise, std::ref(deser), deserialise, symex_head_start);
114+
return run_parallel(os, opt, prog, learn, preproc);
115+
}
115116
#endif
116-
return run_parallel(os, opt, prog, learn, preproc);
117+
return run_parallel(os, opt, prog, ga_learn, preproc);
117118
}
118119
typedef tournament_selectt<program_populationt> selectt;
119120
selectt select(rounds);
120-
typedef ga_learnt<selectt, random_mutatet, random_crosst, fitnesst,
121-
danger_fitness_configt> ga_learnt;
121+
typedef ga_learnt<selectt, mutatet, crosst, fitnesst, danger_fitness_configt> ga_learnt;
122122
ga_learnt ga_learn(opt, rnd, select, mutate, cross, fitness, converter);
123123
#ifndef _WIN32
124-
concurrent_learnt<ga_learnt, symex_learnt> learn(ga_learn, symex_learn,
125-
serialise, std::ref(deser), deserialise, symex_head_start);
126-
#else
127-
// TODO: Remove once task_pool supports Windows.
128-
ga_learnt &learn=ga_learn;
124+
if (!opt.get_bool_option(CEGIS_GENETIC_ONLY))
125+
{
126+
concurrent_learnt<ga_learnt, symex_learnt> learn(ga_learn, symex_learn,
127+
serialise, std::ref(deser), deserialise, symex_head_start);
128+
return run_parallel(os, opt, prog, learn, preproc);
129+
}
129130
#endif
130-
return run_parallel(os, opt, prog, learn, preproc);
131-
return 0;
131+
return run_parallel(os, opt, prog, ga_learn, preproc);
132132
}
133133

134134
template<class preproct>

src/cegis/options/parameters.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#define CEGIS_INVARIANT_PARAMETERS_H_
1212

1313
#define CEGIS_GENETIC "cegis-genetic"
14+
#define CEGIS_GENETIC_ONLY "cegis-genetic-only"
1415
#define CEGIS_MAX_SIZE "cegis-max-size"
1516
#define CEGIS_SEED "cegis-seed"
1617
#define CEGIS_STATISTICS "cegis-statistics"

src/cegis/runner/cegis_parse_options.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ void cegis_parse_optionst::get_command_line_options(optionst &options)
7878
options.set_option("cegis-match-select", !cmdline.isset("cegis-tournament-select"));
7979
options.set_option("cegis-statistics", cmdline.isset("cegis-statistics"));
8080
options.set_option(CEGIS_GENETIC, cmdline.isset(CEGIS_GENETIC));
81+
options.set_option(CEGIS_GENETIC_ONLY, cmdline.isset(CEGIS_GENETIC_ONLY));
8182
set_integer_option(options, cmdline, "cegis-genetic-rounds", 10u);
8283
set_integer_option(options, cmdline, "cegis-seed", 747864937u);
8384
set_integer_option(options, cmdline, "cegis-genetic-popsize", 2000u);

src/cegis/runner/cegis_parse_options.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Author: Daniel Kroening, [email protected]
1515
"(cegis)(cegis-seed):(cegis-root):(cegis-targets):" \
1616
"(cegis-min-prog-size):(cegis-max-prog-size):(cegis-skolem):(cegis-ranking):" \
1717
"(cegis-max-size):(cegis-statistics)(cegis-show-iterations)" \
18-
"(cegis-keep-goto-programs)(cegis-genetic)(cegis-genetic-rounds):" \
18+
"(cegis-keep-goto-programs)(cegis-genetic)(cegis-genetic-only)(cegis-genetic-rounds):" \
1919
"(cegis-genetic-popsize):(cegis-tournament-select)" \
2020
"(cegis-genetic-mutation-rate):(cegis-genetic-replace-rate):" \
2121
"(cegis-limit-wordsize)(cegis-parallel-verify)(cegis-symex-head-start):" \

0 commit comments

Comments
 (0)