corneto.methods.PrizeCollectingSteinerTree#
- class corneto.methods.PrizeCollectingSteinerTree(include_all_terminals=False, max_flow=None, default_edge_cost=1.0, flow_name='_flow', root_vertex=None, root_selection_strategy='first', best_root_candidates='data', epsilon=1, strict_acyclic=True, disable_structured_sparsity=False, in_flow_edge_type=EdgeType.DIRECTED, out_flow_edge_type=EdgeType.DIRECTED, lambda_reg=0.0, force_flow_through_root=False, backend=None)#
Bases:
FlowMethodPrize-Collecting Steiner Tree optimization method built on top of FlowMethod.
In a prize-collecting Steiner tree problem, terminals can have prizes (values > 0), making them optional terminals that provide a benefit if included in the solution. The class supports providing multiple max_flow and root_vertex values per sample.
- Parameters:
include_all_terminals (bool)
default_edge_cost (float)
flow_name (str)
root_selection_strategy (Literal['first', 'best'])
best_root_candidates (Literal['data', 'graph'])
epsilon (float)
strict_acyclic (bool)
disable_structured_sparsity (bool)
in_flow_edge_type (EdgeType)
out_flow_edge_type (EdgeType)
lambda_reg (float)
force_flow_through_root (bool)
backend (Backend | None)
- __init__(include_all_terminals=False, max_flow=None, default_edge_cost=1.0, flow_name='_flow', root_vertex=None, root_selection_strategy='first', best_root_candidates='data', epsilon=1, strict_acyclic=True, disable_structured_sparsity=False, in_flow_edge_type=EdgeType.DIRECTED, out_flow_edge_type=EdgeType.DIRECTED, lambda_reg=0.0, force_flow_through_root=False, backend=None)#
- Parameters:
include_all_terminals (bool)
default_edge_cost (float)
flow_name (str)
root_selection_strategy (Literal['first', 'best'])
best_root_candidates (Literal['data', 'graph'])
epsilon (float)
strict_acyclic (bool)
disable_structured_sparsity (bool)
in_flow_edge_type (EdgeType)
out_flow_edge_type (EdgeType)
lambda_reg (float)
force_flow_through_root (bool)
backend (Backend | None)
Methods
__init__([include_all_terminals, max_flow, ...])build(graph[, data, prizes, terminals, ...])Build a single-condition PCST problem from explicit inputs.
build_from_data(graph[, data])Build the complete optimization problem.
build_many(graph, *, prizes[, terminals, ...])Build a multi-condition PCST problem from named condition mappings.
create_flow_based_problem(flow_problem, ...)Create the flow-based optimization problem.
create_problem(graph, data)Create the optimization problem using a flow-based formulation.
description()Returns a description of the method.
get_flow_bounds(graph, data)Get the flow bounds for the optimization problem.
name()Returns the name of the method.
preprocess(graph, data)Preprocess the graph and data.
references()Returns citation keys for this method.
show_bibtex()Display raw BibTeX entries in a formatted block for easy copying.
show_references()Display formatted citations in a Jupyter notebook.
Attributes
backendReturn the optimization backend being used.
- build(graph, data=None, *, prizes=None, terminals=None, edge_costs=None)#
Build a single-condition PCST problem from explicit inputs.
- build_many(graph, *, prizes, terminals=None, edge_costs=None)#
Build a multi-condition PCST problem from named condition mappings.
- Parameters:
graph (BaseGraph)
- preprocess(graph, data)#
Preprocess the graph and data.
- get_flow_bounds(graph, data)#
Get the flow bounds for the optimization problem.