def process_instance(store, domain, instance, disable=True): if instance.enumerated: return [] new_results, new_facts = instance.next_results(verbose=store.verbose) if disable: instance.disable(store.evaluations, domain) for result in new_results: add_certified(store.evaluations, result) # TODO: only add if the fact is actually new? if disable: remove_blocked(store.evaluations, instance, new_results) add_facts(store.evaluations, new_facts, result=None, complexity=0) # TODO: record the instance return new_results
def process_instance(instantiator, store, instance, verbose=False): #, **complexity_args): if instance.enumerated: return [] start_time = time.time() new_results, new_facts = instance.next_results(verbose=verbose) store.sample_time += elapsed_time(start_time) evaluations = store.evaluations #remove_blocked(evaluations, instance, new_results) for result in new_results: complexity = result.compute_complexity(evaluations) #complexity = instantiator.compute_complexity(instance) for evaluation in add_certified(evaluations, result): instantiator.add_atom(evaluation, complexity) fact_complexity = 0 # TODO: record the instance or treat as initial? for evaluation in add_facts(evaluations, new_facts, result=UNKNOWN_EVALUATION, complexity=fact_complexity): instantiator.add_atom(evaluation, fact_complexity) if not instance.enumerated: instantiator.push_instance(instance) return new_results
def process_instance(store, domain, instance, disable=True): if instance.enumerated: return [] evaluations = store.evaluations new_results, new_facts = instance.next_results(verbose=store.verbose) if disable: instance.disable(evaluations, domain) for result in new_results: #add_certified(evaluations, result) # TODO: only add if the fact is actually new? complexity = INF if result.external.is_special() or not disable else \ result.compute_complexity(store.evaluations) add_facts(store.evaluations, result.get_certified(), result=result, complexity=complexity) if disable: remove_blocked(store.evaluations, instance, new_results) add_facts(store.evaluations, new_facts, result=None, complexity=0) # TODO: record the instance return new_results
def process_instance(store, domain, instance): success = False if instance.enumerated: return success new_results, new_facts = instance.next_results(accelerate=1, verbose=store.verbose) instance.disable(store.evaluations, domain) for result in new_results: success |= bool(add_certified(store.evaluations, result)) remove_blocked(store.evaluations, instance, new_results) success |= bool(add_facts(store.evaluations, new_facts, result=None, complexity=0)) # TODO: record the instance return success
def process_instance(store, domain, instance, disable=False): if instance.enumerated: return [], [] start_time = time.time() new_results, new_facts = instance.next_results(verbose=store.verbose) store.sample_time += elapsed_time(start_time) evaluations = store.evaluations if disable: instance.disable(evaluations, domain) for result in new_results: #add_certified(evaluations, result) # TODO: only add if the fact is actually new? complexity = INF if (not disable or result.external.is_special) else \ result.compute_complexity(evaluations) add_facts(evaluations, result.get_certified(), result=result, complexity=complexity) if disable: remove_blocked(evaluations, domain, instance, new_results) add_facts(evaluations, new_facts, result=UNKNOWN_EVALUATION, complexity=0) # TODO: record the instance return new_results, new_facts
def process_instance(instantiator, evaluations, instance, verbose=False): #, **complexity_args): if instance.enumerated: return False new_results, new_facts = instance.next_results(verbose=verbose) #remove_blocked(evaluations, instance, new_results) for result in new_results: complexity = result.compute_complexity(evaluations) #complexity = instantiator.compute_complexity(instance) for evaluation in add_certified(evaluations, result): instantiator.add_atom(evaluation, complexity) fact_complexity = 0 # TODO: record the instance or treat as initial? for evaluation in add_facts(evaluations, new_facts, result=None, complexity=fact_complexity): instantiator.add_atom(evaluation, fact_complexity) if not instance.enumerated: instantiator.push_instance(instance) return True