This GitLab instance reached the end of its service life. It won't be possible to create new users or projects.

Please read the deprecation notice for more information concerning the deprecation timeline

Visit migration.git.tu-berlin.de (internal network only) to import your old projects to the new GitLab platform 📥

NaiveTransitiveClosure.scala 726 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
package de.bbisping.coupledsim.algo

import scala.annotation.migration
import de.bbisping.coupledsim.ts.TransitionSystem
import de.bbisping.coupledsim.util.FixedPoint
import de.bbisping.coupledsim.util.LabeledRelation

class NaiveTransitiveClosure[S, A, L] (
    ts: TransitionSystem[S, A, L],
    transitiveSteps: Set[A]) {
  
  def compute() = {
    FixedPoint[LabeledRelation[S, A]] (
      { p =>
        val newTrans = for {
          s <- ts.nodes
          a1 <- transitiveSteps
          ns <- p.values(s, a1)
          a2 <- transitiveSteps
          ns2 <- p.values(ns, a2)
        } yield (s, a1, ns2)
        new LabeledRelation(p.tupleSet ++ newTrans)
      },
      _.size == _.size
    ) (ts.step)
    
  }
  
}