1 个不稳定版本

0.1.0 2021 年 8 月 4 日

#1074 in 数学

MIT/Apache

165KB
3.5K SLoC

PNETS TPN_

PNETS reduce 是一个库,可以在保持网络某些属性的同时缩减 Petri 网络结构


此 crate 提供了在 Petri 网上创建缩减的 API,并集成了论文《从缩减方程中计算 Petri 网标记》中描述的一些缩减。

此 crate 提供了在 Petri 网上创建缩减的 API,并集成了出版物《STTT》中描述的一些缩减。

此 crate 提供了两个模块

modifications 模块收集了可以对网络进行的各种修改,同时保留某些属性。

reducers 模块提供了三个特性:ReducePlaceReduceTransitionReduce,允许所有缩减算法具有一个公共接口。

还有一些通用的缩减算法,这使得处理缩减的链式和循环更容易:IdentityReducerLoopReducerSmartReducerChainReducer

此库版本还提供了在 reductions::standard 模块中应用的针对标准 Petri 网的缩减。

使用方法

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)?;
}

依赖项

~1MB
~12K SLoC