Crates.io | pnets_shrunk |
lib.rs | pnets_shrunk |
version | 0.1.0 |
source | src |
created_at | 2021-08-04 14:19:48.666957 |
updated_at | 2021-08-04 14:19:48.666957 |
description | A reducer for petri nets |
homepage | https://github.com/fomys/pnets/tree/master/pnets_shrunk |
repository | https://github.com/fomys/pnets |
max_upload_size | |
id | 431523 |
size | 66,779 |
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.
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)?;
}