pnets_shrunk

Crates.iopnets_shrunk
lib.rspnets_shrunk
version0.1.0
sourcesrc
created_at2021-08-04 14:19:48.666957
updated_at2021-08-04 14:19:48.666957
descriptionA reducer for petri nets
homepagehttps://github.com/fomys/pnets/tree/master/pnets_shrunk
repositoryhttps://github.com/fomys/pnets
max_upload_size
id431523
size66,779
Louis Chauvet (Fomys)

documentation

https://docs.rs/pnets_shrunk/

README

PNETS TPN_

PNETS reduce is a library which reduce Petri nets according while keeping some properties on the network


This crate provides an api for creating reductions on Petri nets and integrating some of the reductions described in the paper Counting Petri net markings from reduction equations.

This crate provides an api for creating reductions on Petri nets and integrating some of the reductions described in the publication STTT.

This crate provides two modules:

The modifications module gathers the different modifications that can be made to a network while preserving certain properties.

The reducers module provides three features: Reduce, PlaceReduce and TransitionReduce which allow all reduction algorithms to have a common interface.

There are also generic reduction algorithms that make it easier to handle chaining and looping of reductions: IdentityReducer, LoopReducer, SmartReducer and ChainReducer.

This version of the library also provides reductions that apply to standard Petri nets within the reductions::standard module.

Usage

use pnets::standard::Net;
use pnets_shrunk::reducers::standard::SimpleChainReducer;

fn main() {
    // Load a standard Petri net from stdin
    let mut net = Net::from(pnets_tina::Parser::new(BufReader::new(io::stdin())).parse()?);
    
    // Application of the reduction
    let mut modifications = vec![];
    SimpleChainReducer::reduce(&mut net, &mut modifications);

    // Auto naming is needed to allow fill name for auto-created places
    net.auto_name();
    
    // Display modifications
    println!("{:?}", modifications);
    // Display new network on stdout
    ExporterBuilder::new(file)
        .build()
        .export(net)?;
}
Commit count: 29

cargo fmt