
import os
import copy
import decisiondiagram_core

DecisionDiagram = decisiondiagram_core.DecisionDiagram

import decisiondiagram_core
import decisiondiagram_basic
import decisiondiagram_operation

# 
# Usage:	produceDD(variable_dict, variable_list, function)
#
# Given a function, the produceDD generates the decision diagram by 
# brute-force searching. Each input is identified by a globally unique 
# variable ID given in variable_list. And variable_dict specifies its 
# range.  
#
# variable_dict: a dictionary where each key is a unique variable ID
#	 	and each value is the size of range of a variable
# variable_list: a list where each element in the list is a variable 
# 		ID that identifies the parameter in the parameter list
# function:	 the function from which the decision diagram is built
#
# Returns the resulting decision diagram
#
produceDD = decisiondiagram_basic.GlobalDecisionDiagramFactory.produceDD

# 
# Usage: 	evaluate(DecisionDiagram, assignment_dict)
# 
# Evaluate the given variables in the decision diagram to the
# corresponding values in the assignment_dict.
#
# DecisionDiagram: the decision diagram to be evaluated
# assignment_dict: the assignment dictionary where each key is a variable ID 
#		   and each value is the corresponding assginment	
# 
# Returns the resulting decision diagram with given variables evaluated
#
evaluate  = decisiondiagram_operation.evaluate

#
# Usage: 	merge(DecisionDiagram_list)
#
# Merge multiple decision diagrams into one. Note the merge operation does not 
# change the structure of each decision diagram but finds the parts in common. 
# The identical parts will be shared in the resulting decision diagram.
#
# DecisionDiagram_list: a list that contains the decision diagrams to be merged
#
# Returns the merged decision diagram
#
merge     = decisiondiagram_operation.merge


#
# Usage:	ite(DecisionDiagram, DecisionDiagram_list)
#
# ITE function for the decision diagram
#
# DecisionDiagram: a decision diagram as the condition
# DecisionDiagram_list: a list of decision diagrams with the size equals the rage 
# of the condition decision diagram.
#
# Returns the resulting decision diagram
#
ite       = decisiondiagram_operation.ite

#
# Usage: 	combine(DecisionDiagram, DecisionDiagram)
#
# Combine two decision diagrams into one. The output of the resulting decision 
# diagram is the combinations of the outputs of the two input decision diagrams
#
# Returns the decision diagram with combined output
#
combine   = decisiondiagram_operation.combine

#
# Usage: 	combine(DecisionDiagram_list)
#
# Combine multiple decision diagrams into one. The output of the resulting decision 
# diagram is the combinations of the outputs of the input decision diagrams
#
# Returns the decision diagram with combined output
#
combine_more = decisiondiagram_operation.combine_more

#
# Usage: 	reorder(DecisionDiagram)
#
# Reorder the variables in the decision diagram
#
# Returns the decision diagram with variables reordered 
#
reorder   = decisiondiagram_operation.reorder

