Skip to content
This repository was archived by the owner on Oct 29, 2020. It is now read-only.
This repository was archived by the owner on Oct 29, 2020. It is now read-only.

Real variables (constraints) #8

@FAMILIAR-project

Description

@FAMILIAR-project

The current strategy is to "emulate" real (double) with integer with ad-hoc management of precision...
Basically we multiply the double by the precision needed (10, 100, ...) and then convert back the values (solution) by dividing.

FeatureModelVariable fmv = FM("VARY_LATEX : [SUBTITLE] FIGURE_TUX ACK LONG_AFFILIATION; ACK : (MOREACK|BOLDACK); LONG_AFFILIATION : [EMAIL]  ; ");
      fmv.setFeatureAttribute(fmv.getFeature("FIGURE_TUX"), "vspace_tux", new IntegerDomainVariable("", 5, 10)); // TODO: type the attribute
      fmv.setFeatureAttribute(fmv.getFeature("FIGURE_TUX"), "size_tux", new DoubleDomainVariable("", 3.0, 5.0, 100.0)); // TODO: type the attribute
      Collection<AttributedConstraintVariable> cstsAtts = new HashSet<>();
      cstsAtts.add(new AttributedConstraintVariable(new AttributedExpression("vspace_tux", ArithmeticCompOperator.GE, 7)));
      cstsAtts.add(new AttributedConstraintVariable(new AttributedExpression("size_tux", ArithmeticCompOperator.GE, 4.9)));

It works pretty well.
The problem I am seeing is when you want to constrain two real variables that have not the same precision

 fmv.setFeatureAttribute(fmv.getFeature("FIGURE_TUX"), "size_tux", new DoubleDomainVariable("", 3.0, 5.0, 100.0)); // TODO: type the attribute
 fmv.setFeatureAttribute(fmv.getFeature("FIGURE_TUX"), "size_tux2", new DoubleDomainVariable("", 3.0, 5.0, 10.0)); // TODO: type the attribute
cstsAtts.add(new AttributedConstraintVariable(new AttributedExpression("size_tux", ArithmeticCompOperator.GE, "size_tux2")));

In such cases, you will compare 30 with 300 :(
So an idea is to have a fixed precision for all double variables.

We have to be careful with constraints between integers and doubles

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions