Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal for new operation: FMVariationPoints (already implemented) #99

Open
jmhorcas opened this issue Aug 7, 2024 · 1 comment
Open
Assignees
Labels
enhancement New feature or request

Comments

@jmhorcas
Copy link
Contributor

jmhorcas commented Aug 7, 2024

The variation points of a feature model are those features that may require to make a choice (i.e., select a variant) to form a valid configuration.
This operation returns all possible variation points and the variants of each variation point represented in the feature model.

I've got already implemented this operation in FM Metamodel following the Flamapy architecture. I will upload it if this operation is interesting for community and the Flamapy team agrees.
Usages of this operation: Horcas et al. ConfWS 2021
Here an snippet of code:

def variation_points(feature_model: FeatureModel) -> dict[Feature, list[Feature]]:
    vps: dict[Feature, list[Feature]] = dict()
    features = [feature_model.root]
    while features:
        feature = features.pop()
        variants = []
        for relation in feature.get_relations():
            if not relation.is_mandatory():
                variants.extend(relation.children)
        if variants:
            vps[feature] = variants
        features.extend(feature.get_children())
    return vps
@jmhorcas jmhorcas added the enhancement New feature or request label Aug 7, 2024
@jagalindo
Copy link
Member

That sounds great @jmhorcas, if you have it coded, just commit it to the develop branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants