KernelHaven / PsFmExtractor

Variability-model extractor for KernelHaven
Apache License 2.0
0 stars 0 forks source link

How to handle constraint file for variables Hashmap? #1

Closed IBaydenI closed 4 years ago

IBaydenI commented 4 years ago

See c431be9478c889dd1342704309fa89952fb261c8 Line 57 and 92.

VariabilityModel result needs a Hashmap that contains the variability variables. That Map requires two parameters:

  1. ConstraintModel
  2. variables

Since we don't have a constraint Model, how is this supposed to be handled?

Elscha commented 4 years ago

Hello @IBaydenI,

Yes, the VariabilityModel requires a DIMACS file, which contains the translation of all constraints into CNF in order to provide logical tests. However, MetricHaven doesn’t need this file. Please create a small text/ASCII file with two lines, add the following content to be consistent with the API of KernelHaven (the second line is an empty line), and pass this to the VariabilityModel:

p cnf 0 0

Best regards, Sascha

adam-sse commented 4 years ago

The solution used elsewhere is to set an empty temporary file, see for example https://github.com/KernelHaven/KernelHaven/blob/master/src/net/ssehub/kernel_haven/variability_model/EmptyVariabilityModelExtractor.java#L44-L46

It is best not to set an "empty" DIMACS file, as this would imply that the extractor has the ability to create DIMACS constraints. A completely empty file simply causes any SAT solvers to fail, which is the desired behavior. (A DIMACS file with no variables would not cause errors for the SAT solvers.)

IBaydenI commented 4 years ago

Implemented solution proposed by @adam-sse in 9fc90e610d11afa5afc99ad57e4905e59cbe8ea3