concepts.pdsketch.parsers.csp_parser.PDSketchCSPParser#

class PDSketchCSPParser[source]#

Bases: PDSketchParser

Parser for PDSketch domain and problem files. Users should not use this class directly. Instead, use the following functions:

Methods

incremental_define_domain(domain, tree)

Incrementally define a PDSketch domain from a tree.

load(file)

Load a domain or problem file and return the corresponding tree.

loads(string)

Load a domain or problem string and return the corresponding tree.

make_csp_problem(tree, domain[, ...])

Construct a PDSketch problem from a tree.

make_domain(tree[, domain_file_paths])

Construct a PDSketch domain from a tree.

make_expression(domain, tree[, variables])

Construct a PDSketch expression from a tree.

make_problem(tree, domain[, ...])

Construct a PDSketch problem from a tree.

Attributes

grammar_file

The grammar definition for PDSketch.

__init__()#
__new__(**kwargs)#
incremental_define_domain(domain, tree)#

Incrementally define a PDSketch domain from a tree.

Parameters:
Return type:

None

load(file)#

Load a domain or problem file and return the corresponding tree.

Return type:

Tree

loads(string)#

Load a domain or problem string and return the corresponding tree.

Return type:

Tree

make_csp_problem(tree, domain, ignore_unknown_predicates=False)[source]#

Construct a PDSketch problem from a tree.

Parameters:
  • tree (Tree)

  • domain (Domain)

  • ignore_unknown_predicates (bool)

Return type:

NamedConstraintSatisfactionProblem

make_domain(tree, domain_file_paths=tuple())#

Construct a PDSketch domain from a tree.

Parameters:
Return type:

Domain

make_expression(domain, tree, variables=None)#

Construct a PDSketch expression from a tree.

Parameters:
Return type:

Expression

make_problem(tree, domain, ignore_unknown_predicates=False)#

Construct a PDSketch problem from a tree.

Parameters:
  • tree (Tree)

  • domain (Domain)

  • ignore_unknown_predicates (bool)

Return type:

Problem

grammar_file = '/Users/jiayuanm/Projects/Concepts/concepts/pdsketch/parsers/pdsketch-v2.grammar'#

The grammar definition for PDSketch.