easyiec.core.Problem#

class easyiec.core.Problem[source]#

Bases: object

Base class of interactive optimization problems.

Subclasses set space and implement render() and/or _image(); everything else has a sensible default.

Attributes:
namestr

Registry key (easyiec.problems.make(name)).

titlestr

Display name.

domainstr

Application area ("process engineering", "image processing", "generative art", …).

goalstr

Default goal in natural language (shown to people and LLM judges).

descriptionstr

What a candidate looks like; prepended to LLM prompts.

spaceBox

Real-coded search space (None for structured genomes).

image_sizeint

Default side of rendered images.

apply_edit(x, handles)[source]#

Genome after the knots were moved to handles.

describe(x)[source]#

Text description of a candidate (for text-only judges).

descriptor(x)[source]#

2-D behaviour descriptor in [0, 1]^2 for quality-diversity archives.

descriptors = ((0, (0.0, 1.0)), (2, (0.0, 1.0)))#

indices of two features spanning a quality-diversity map, with ranges

edit_handles(x)[source]#

Knot points (k, 2) a person can drag (problems with editable curves).

feature_names = ['brightness', 'contrast', 'colorfulness', 'saturation', 'hue_x', 'hue_y', 'entropy', 'edge_density', 'symmetry_lr', 'symmetry_ud', 'coverage', 'complexity']#

phenotype descriptor names (default: generic image features)

features(x)[source]#

Phenotype features in psychological space (default: image features).

modality = 'image'#

modality presented to judges: “image” or “text”

objectives(x)[source]#

Key performance indicators (engineering problems); empty by default.

presets()[source]#

Named, hand-picked genomes ({name: genome}) for seeding and demos.

random(rng, n=None)[source]#

Random genome(s) from the search space.

render(x, ax=None, **kw)[source]#

Draw the phenotype on a matplotlib Axes and return it.

render_plot(x, ax)[source]#

Plot-type phenotypes (curves, layouts) draw here; used by _image().

repair(x)[source]#

Make a genome feasible (default: clip to the box).

semantic_axes = {}#

{phrase: direction vector in the unit cube} for verbal steering

to_image(x, size=None)[source]#

uint8 RGB image of the phenotype (size × size).

utility(x, target=None)[source]#

Default hidden utility in [0, 1] (ground truth of benchmarks).

With a target genome it is a Gaussian similarity of standardized phenotype features; subclasses with explicit objectives override it.

utility_width = 0.15#

width of the default target-similarity utility (root-mean-square feature distance)