solution

MacSyFinder find lot of potential systems for the same model, all these systems are saved in “all_systems.xxx” files. This module allow to explore among of all systems which combination seems to be more probable.

solution API reference

Solution

class macsypy.solution.Solution(systems)[source]

Handle Solution, a solution is a set of compatible Systems

when compare solutions we check the following criteria

  1. The number of hits

  2. The number of systems

  3. The average of wholeness

  4. The hits position (is used ti give predictable output for unit tests)

__eq__(other)[source]

Return self==value.

__gt__(other)[source]

Return self>value.

__hash__ = None
__init__(systems)[source]
__iter__()[source]

Solution allow to iterate over the systems

Returns:

generator

__lt__(other)[source]

Return self<value.

__weakref__

list of weak references to the object (if defined)

_sorted_systems(systems)[source]

sort the systems following the positions of th hits that composed the systems

Parameters:

systems (list of mcsypy.system.System objects) – the systems to sort

Returns:

a sorted copy of the systems

Return type:

list of mcsypy.system.System objects

property average_wholeness

The average of the systems wholeness

property hits_number

The sum of the hits of each systems in this solution

property hits_positions

The list of position of all hits of the solution

property score

The score of this solution

property systems

“a sorted list of the systems that composed the solution

combine_clusters

macsypy.solution.combine_clusters(clusters, true_loners, multi_loci=False)[source]

generate the combinations of clusters, with loners and multi systems

Parameters:
Returns:

all available combination of clusters

Return type:

List of combination. a combination is a tuple of macsypy.cluster.Cluster objects

combine_multisystems

macsypy.solution.combine_multisystems(rejected_candidates, multi_systems)[source]
Parameters:
Returns:

list of cluster combination with teh multisystem

Return type:

[(macsypy.cluster.Cluster cluster1, cluster2, …), (macsypy.cluster.Cluster cluster3, cluster4, …)]

find_best_solutions

macsypy.solution.find_best_solutions(systems)[source]

Among the systems choose the combination of systems which does not share macsypy.hit.CoreHit and maximize the sum of systems scores

Parameters:

systems (list of macsypy.system.System object) – the systems to analyse

Returns:

the list of list of systems which represent one best solution and the it’s score

Return type:

tuple of 2 elements the best solution and it’s score ([[macsypy.system.System, …], [macsypy.system.System, …]], float score) The inner list represent a best solution