maxitg / SetReplace

C++/Wolfram Language package for exploring set and graph rewriting systems
MIT License
219 stars 44 forks source link

Feature association #528

Closed mrektor closed 3 years ago

mrektor commented 3 years ago

Changes

Comments

Examples

In[] := WolframModel[{{x, y}, {x, z}} -> {{x, z}, {x, w}, {y, w}, {z, w}}, {{0, 0}, {0, 0}}, 5]["FeatureAssociation"]
Out[] = <| "CausalGraphVertexCount" -> 22, "CausalGraphEdgeCount" -> 42, 
 "CausalGraphVertexConnectivity" -> 1, 
 "CausalGraphVertexDegreesQuantiles" -> {2, 2, 2, 6, 6}, 
 "StructurePreservingFinalStateVertexCount" -> 115, 
 "StructurePreservingFinalStateEdgeCount" -> 138, 
 "StructurePreservingFinalStateVertexConnectivity" -> 2, 
 "StructurePreservingFinalStateVertexDegreesQuantiles" -> {2, 2, 2, 2, 8} |>

This change is Reviewable

maxitg commented 3 years ago

We need to compute the evolution objects within the VerificationTest. The output from the failed tests is way too large and makes it very hard to understand what's going on.

mrektor commented 3 years ago

I think that what's "failing" are the error messages checks (testUnevaluated)

image

maxitg commented 3 years ago

I think that what's "failing" are the error messages checks (testUnevaluated)

I think it's because the WolframModel has evaluated into WolframModelEvolutionObject, and testUnevaluated expects the input to remain completely unevaluated. A solution would be to generate the evolution object before the test or pass the property to WolframModel directly.

maxitg commented 3 years ago

That does not fix the tests, that skips them. You just evaluated the argument of testUnevaluated before it even gets into the test, so of course the test passes because there is nothing left to evaluate.

It does, however, produce messages while pre-evaluating it which is why CI fails (it does not allow messages).

daneelsan commented 3 years ago

If:

  1. the attribute of testUnevaluated in the .wlt file is set to HoldAllComplete
  2. Evaluate is replaced with With , then the tests pass:
      Attributes[Global`testUnevaluated] = Attributes[Global`testSymbolLeak] = {HoldAllComplete};
          (* Error Messages check *)
          With[{obj = evolutionObjects[[3]]}, {
            testUnevaluated[obj["FeatureAssociation", 3], {WolframModelEvolutionObject::invalidFeatureSpec}],
            testUnevaluated[obj["FeatureAssociation", "EasterEgg"], {WolframModelEvolutionObject::unknownFeatureGroup}]
          }]

image