Problem

class iohblade.problem.Problem(logger=None, training_instances=None, test_instances=None, name='Problem', eval_timeout=600)

Bases: ABC

Abstract problem class.

abstract evaluate(solution: Solution)

Evaluates a solution on training instances and updates its fitness and feedback.

Args:

solution (Solution): Solution object to be evaluated.

abstract get_prompt()

Get the full prompt describing the problem and how to format the answer.

set_logger(logger)

Sets the logger for this problem.

abstract test(solution: Solution)

Performs a complete evaluation on test instances and returns the fitness score.

Args:

solution (Solution): Solution object to be tested.

abstract to_dict()

Returns a dictionary representation of the problem including all parameters.

Returns:

dict: Dictionary representation of the problem.

iohblade.problem.evaluate_in_subprocess(problem, conn, solution)

Runs the evaluation and stores the result in a queue. Args:

queue (multiprocessing.Queue): Queue for storing the evaluation result. solution (Solution): Solution object to be evaluated.