Skip to content

Commit 79c1019

Browse files
committed
Added generic stubs to CEGIS refactoring.
1 parent eb74e17 commit 79c1019

File tree

10 files changed

+105
-0
lines changed

10 files changed

+105
-0
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
interface ITaxCalculator {
2+
double addTaxes(double price);
3+
}
4+
class UsaTaxCalculator implements ITaxCalculator {
5+
public double addTaxes(double price) {
6+
return price * 1.25;
7+
}
8+
}
9+
class NullTaxCalculator implements ITaxCalculator {
10+
public double addTaxes(double price) {
11+
return price;
12+
}
13+
}
14+
15+
public class Runner {
16+
void sale(ITaxCalculator calc, double price) {
17+
if (calc != null)
18+
price = calc.addTaxes(price);
19+
}
20+
void print(ITaxCalculator calc, double price) {
21+
double percentage;
22+
if (calc == null)
23+
percentage=0;
24+
else
25+
percentage=calc.addTaxes(100.0) - 100.0;
26+
27+
System.out.print("Tax rate: ");
28+
System.out.print(percentage);
29+
System.out.println('%');
30+
}
31+
}
Binary file not shown.

src/cegis/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ SRC = danger/meta/meta_variable_names.cpp danger/facade/danger_runner.cpp danger
5353
control/simplify/remove_unused_elements.cpp \
5454
control/verify/control_symex_verify.cpp control/verify/insert_solution.cpp \
5555
control/value/float_helper.cpp control/value/control_types.cpp \
56+
refactor/environment/instrument_state_vars.cpp refactor/instructionset/create_cegis_processor.cpp \
5657
wordsize/restrict_bv_size.cpp value/program_individual_serialisation.cpp value/assignments_printer.cpp \
5758
seed/literals_seed.cpp \
5859
genetic/instruction_set_info_factory.cpp genetic/random_mutate.cpp genetic/random_cross.cpp \
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include <cegis/refactor/environment/instrument_state_vars.h>
2+
3+
void instrument_state_vars(const goto_programt::const_targett first,
4+
const goto_programt::const_targett last)
5+
{
6+
// TODO: Implement
7+
assert(false);
8+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*******************************************************************
2+
3+
Module: Counterexample-Guided Inductive Synthesis
4+
5+
Author: Daniel Kroening, [email protected]
6+
Pascal Kesseli, [email protected]
7+
8+
\*******************************************************************/
9+
10+
#ifndef CEGIS_REFACTOR_ENVIRONMENT_INSTRUMENT_STATE_VARS_H_
11+
#define CEGIS_REFACTOR_ENVIRONMENT_INSTRUMENT_STATE_VARS_H_
12+
13+
#include <goto-programs/goto_program.h>
14+
15+
/**
16+
* @brief
17+
*
18+
* @details
19+
*
20+
* @param first
21+
* @param last
22+
*/
23+
void instrument_state_vars(
24+
goto_programt::const_targett first,
25+
goto_programt::const_targett last);
26+
27+
#endif /* CEGIS_REFACTOR_ENVIRONMENT_INSTRUMENT_STATE_VARS_H_ */
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include <cegis/refactor/instructionset/create_cegis_processor.h>
2+
3+
void create_cegis_processor(const std::set<typet> &state_types,
4+
const size_t var_slots_per_state_type, const std::set<typet> &context_types)
5+
{
6+
7+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*******************************************************************
2+
3+
Module: Counterexample-Guided Inductive Synthesis
4+
5+
Author: Daniel Kroening, [email protected]
6+
Pascal Kesseli, [email protected]
7+
8+
\*******************************************************************/
9+
10+
#ifndef CEGIS_REFACTOR_INSTRUCTIONSET_CREATE_CEGIS_PROCESSOR_H_
11+
#define CEGIS_REFACTOR_INSTRUCTIONSET_CREATE_CEGIS_PROCESSOR_H_
12+
13+
#include <set>
14+
15+
#include <util/type.h>
16+
17+
/**
18+
* @brief
19+
*
20+
* @details
21+
*
22+
* @param state_types
23+
* @param var_slots_per_state_type
24+
* @param context_types
25+
*/
26+
void create_cegis_processor(
27+
const std::set<typet> &state_types,
28+
size_t var_slots_per_state_type,
29+
const std::set<typet> &context_types);
30+
31+
#endif /* CEGIS_REFACTOR_INSTRUCTIONSET_CREATE_CEGIS_PROCESSOR_H_ */

0 commit comments

Comments
 (0)