Skip to content

API

Graph

Attributes Description
Graph.structure Graph structure represented as a matrix of nodes separated by layers
Graph.actual_layer                           . Represent the number of layers of de diagram
Methods Description
Graph.get_node_count() -> int Gets the number of node in the graph.
Graph.get_arc_count() -> int Gets the number of arc in the graph.
Graph.add_node(Node) -> void Add a node to the graph
Graph.create_and_add_node(node_id, node_state) -> Node Creates de node and then it added to the graph
Graph.add_new_layer() -> void Remove not active nodes in layer, construction top_down
Graph.to_string() -> string String representation of the graph.

DD

Attributes Description
DD.problem.                                  . An instance of the problem class, used to create the decision diagram.
Methods Description
DD.create_decision_diagram(verbose) -> void Creates the exact decision diagram, and saves the construction time taken.
DD.create_restricted_decision_diagram(max_width, verbose) -> void Creates the restricted decision diagram, and saves the construction time.
DD.create_relax_priority_decision_diagram(max_width, verbose) -> void Creates a relaxed decision diagram by merging the lowest-priority nodes one by one, and records the construction time.
DD.create_relax_grouping_decision_diagram(max_width, verbose) -> void Creates a relaxed decision diagram by merging nodes in groups by priority difference, and records the construction time.
DD.reduce_decision_diagram(verbose) -> void Reduced decision diagram and stores it in the graph_DD attribute, and saves the reduction time.
DD.export_graph_file(file_name)->void Exports the current decision diagram to a .GML file.
DD.get_decision_diagram()-> Graph Returns the current decision diagram graph object
DD.get_decision_diagram_copy()-> Graph Returns a copy of the decision diagram graph object, ensuring it is not a pointer to the original.
DD.get_building_time()->void Returns the execution time of the DDBuilder.
DD.get_reduction_time()->void Returns the execution time of the reduce of the diagram.

ShortestLongestPath

Methods Description
ShortestLongestPath.get_solution()->PathStructure Retruns the solution of the previously calculated path.
ShortestLongestPath.set_parameters(weights, objective) -> void Sets the parameters of the path weights.
ShortestLongestPath.solve() -> PathStructure Solves the given decision diagram using the previously set weights and objective.

AbstractProblem

Attributes Description
AbstractProblem.initial_state The initial state of the problem, which can be a list, integer, string, etc., depending on the specific problem requirements
AbstractProblem.ordered_variables A list of variables sorted in the specific order that was given.
AbstractProblem.variables_domain A dictionary mapping each variable to its domain.
Methods Description
AbstractProblem.transition_function(previous_state, variable_index, variable_value, scratch_state) -> bool feasibility Abstract method that must be implemented by subclasses to define the transition function. The new state is written into scratch_state; the return value indicates feasibility.
AbstractProblem.get_priority_for_discard_node(state) -> int value Method that should be implemented by subclasses to define the priority function for discarding nodes.
AbstractProblem.get_priority_for_merge_nodes(node_id, state) -> int value Method that should be implemented by subclasses to define the priority function for merging nodes.
AbstractProblem.merge_operator(state_one, state_two) -> State state Method that should be implemented by subclasses to define the new state when two nodes are merged
AbstractProblem.get_state_as_string(state) -> string state Method that should be implemented by subclasses to define a string representation of the state.
AbstractProblem.get_state_copy -> 'State' Gets the copy of the state.
AbstractProblem.get_final_state -> 'State' Gets the final state of the problem.

MaxFlow

Methods Description
MaxFlow.get_time() -> double Returns the execution time of the max-flow algorithm.
MaxFlow.get_max_flow() -> double Returns the precomputed values in the solve_max_flow() section.
MaxFlow.solve_max_flow(capacities) -> double Solves the maximum flow problem in the graph with the provided arc capacities. Returns the maximum flow found by the algorith.
MaxFlow.compute_visited_nodes() -> map Returns a dictionary with the nodes that are visited in the graph.

MaxFlowGurobi

Methods Description
MaxFlowGurobi.get_time() -> double Method that returns the time taken to solve the problem.
MaxFlowGurobi.get_max_flow() -> double Method that returns the maximum flow found by the algorithm.
MaxFlowGurobi.solve_max_flow(capacities) -> double Method that solves and returns the maximum flow problem in a graph.

AbstractCutGenerator

Methods Description
AbstractCutGenerator.get_time() -> double Returns the execution time of the cut algorithm.
AbstractCutGenerator.get_cut() -> pair<vector<double, double>> Returns the precomputed values from the generate_cut() method.
AbstractCutGenerator.generate_cut(x_values, verbose) -> bool Solves the decision diagram, finding a cut. Returns a boolean indicating whether the solution was successfully found.
AbstractCutGenerator.get_name() -> string Returns the name of the cut generator.

CutStrengthening

Methods Description
CutStrengthening.get_time() -> double Returns the execution time of the strengthening algorithm.
CutStrengthening.get_cut_strengthening() -> pair<vector<double>, double> Returns the precomputed values from the cut_strengthening() method.
CutStrengthening.cut_strengthening(coefficients, constant) -> bool Strengthens the cut by improving the coefficients and right-hand side value.
Returns a boolean indicating whether the solution was successfully found.