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.remove_not_active_nodes_down_top(layer_index) -> void Remove not active nodes in layer, construction bottom_up
Graph.remove_not_active_nodes_top_down(layer_index) -> 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(verbose) -> void Creates the restricted decision diagram, and saves the construction time.
DD.create_relaxed_decision_diagram(verbose) -> void Creates the relaxed decision diagram, 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()-> Graph Returns the current decision diagram graph object
DD.get_decision_diagram_graph_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_time() ->string. Retruns the time taken to solve the shortest/longest path.
ShortestLongestPath.get_path()->PathStructure Retruns the solution of the previously calculated path.
ShortestLongestPath.set_parameters(weights, objective) -> void Sets the parameters of the path weights.
ShortestLongestPath.solve_path() -> 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(previus_state, variable_id, variable_value) -> (State state, bool feasibility) Abstract method that must be implemented by subclasses to define the transition function.
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.get_remaining_arcs_capacities() -> unordered_map<string, double> Returns the remaining capacities of the arcs in the graph.
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.

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.

LiftCut

col1 Description
LiftCut.get_time() -> double Returns the execution time of the lift algorithm.
LiftCut.get_lift_cut() -> pair<vector<double, double>> Returns the precomputed values from the lift_cut() method.
LiftCut.lift_cut(coeficcients, constant) -> bool Lifts the cut by improving the coefficients and right-hand side value.
Returns a boolean indicating whether the solution was successfully found.