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 📥

NaiveDeterminismAdder.scala 1.7 KB
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
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.Relation

/** for a class of nodes, splits each node into a group of nodes with one deterministic node for each original outgoing edge 
 *  
 * For example splitting a:
 * 
 * 0 --> a --> b  ~>  0 --> a --> b
 *        `-> c        `-> a --> c
 * 
 * For now, this is only meant to work if the nodes to be deterministified are not direct neighbors of one another.
 *
 * */
class NaiveDeterminismAdder[S, A, L] (
    ts: TransitionSystem[S, A, L],
    nodeCopyLabelFactory: ((S, Int) => S),
    determinismNeeded: Set[S]) {
  
  def compute() = {
//    // stop-nodes are allowed to survive ;)
//    val oldNodes = (determinismNeeded intersect ts.nodes).filter(ts.step.values(_).nonEmpty)
//    
//    val newNodeData = for {
//      oldNode <- oldNodes
//      (outNeighbor, i) <- ts.step.values(oldNode).zipWithIndex
//    } yield (nodeCopyLabelFactory(oldNode, i), oldNode, outNeighbor)
//    
//    val newNodes = for {
//      (node, oldNode, _) <- newNodeData
//    } yield (node, ts.labeling(oldNode))
//    
//    val newInTrans = for {
//      (node, oldNode, _) <- newNodeData
//      inNeighbor <- ts.step.valuesInverse(oldNode)
//    } yield (inNeighbor, node)
//    
//    val newOutTrans = for {
//      (node, _, outNeighbor) <- newNodeData
//    } yield (node, outNeighbor)
//    
//    val newSteps = ts.step removeKeys oldNodes merge new Relation(newInTrans ++ newOutTrans)
//    
//    val newLabeling = ts.labeling.filterKeys(!oldNodes.contains(_)) ++ newNodes
//    
//    TransitionSystem(newSteps, newLabeling)
  }
  
}