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
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.
It works pretty well.
The problem I am seeing is when you want to constrain two real variables that have not the same precision
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