📘 Strategies#

The galactic.algebras.convex.strategies.core module defines the foundational building blocks of strategies.

It provides:

  • the Strategy protocol

  • the BasicStrategy protocol whose results are computed from the characteristics of items. Each subclass implements a specific way to compute the strategy result from the characteristics of item using the _call() method.

Creating strategies#

A strategy is created from a sequence of characteristics and some optional parameters depending on the strategy type.

Applying strategies#

from galactic.algebras.convex.descriptions.core import Concept

top = Concept(connection)
display([str(attr) for attr in top.intent])
concepts = list(strategy(top))
display(
    [
        [str(attr) for attr in sub.intent]
        for sub in concepts
    ]
)
display(
    [
        [item.key for item in sub.extent]
        for sub in concepts
    ]
)
['D(int(@),144)', 'M(int(@),4)']
[['D(int(@),144)', 'M(int(@),4)', 'M(int(@),3)'],
 ['D(int(@),48)', 'M(int(@),16)']]
[[0, 1], [1, 2]]

Extending lattice#

from galactic.algebras.concept.core import ExtensibleLattice
from galactic.algebras.concept.viewer import ConceptRenderer
from galactic.algebras.poset.viewer import HasseDiagram

lattice = ExtensibleLattice()
diagram = HasseDiagram(lattice, domain_renderer=ConceptRenderer(lattice))
diagram
../_images/b559f92db82c2ff94fab394281c86c1d53fa318ffc2e6aa697db72f16885fe01.svg
lattice.extend([top])
diagram
../_images/731f16f3e9cc519ab08e8e90bd8a02f8910a1fd81983a8a06078e3a81b864e3e.svg
lattice.extend(concepts)
diagram
../_images/50baf06a313a989675731d81c53e9038af35c5bede790ea75dbb458e1c8601e5.svg