pm4py.analysis.solve_marking_equation#
- pm4py.analysis.solve_marking_equation(petri_net: PetriNet, initial_marking: Marking, final_marking: Marking, cost_function: Dict[Transition, float] = None) float [source]#
Solves the marking equation of a Petri net using an Integer Linear Programming (ILP) approach. An optional transition-based cost function can be provided to minimize the solution.
- Parameters:
petri_net (
PetriNet
) – The Petri net.initial_marking (
Marking
) – The initial marking of the Petri net.final_marking (
Marking
) – The final marking of the Petri net.cost_function – (Optional) A dictionary mapping transitions to their associated costs. If not provided, a default cost of 1 is assigned to each transition.
- Returns:
The heuristic value obtained by solving the marking equation.
- Return type:
float
import pm4py net, im, fm = pm4py.read_pnml('model.pnml') heuristic = pm4py.solve_marking_equation(net, im, fm)