def new_simulation(self, debug=False, opt_out_cache=False, use_baseline=False, trace=False): # Legacy from scenarios, used in reforms tax_benefit_system = self.tax_benefit_system if use_baseline: while True: baseline = tax_benefit_system.baseline if baseline is None: break tax_benefit_system = baseline builder = SimulationBuilder() if self.attributes: variables = self.attributes.get('input_variables') or {} period = self.attributes.get('period') builder.set_default_period(period) simulation = builder.build_from_variables( tax_benefit_system, variables) else: builder.set_default_period(self.period) simulation = builder.build_from_entities( tax_benefit_system, self.dict) simulation.trace = trace simulation.debug = debug simulation.opt_out_cache = opt_out_cache return simulation
def new_simulation(tax_benefit_system, test_case, period = MONTH): simulation_builder = SimulationBuilder() simulation_builder.set_default_period(period) return simulation_builder.build_from_entities(tax_benefit_system, test_case)