#!/usr/bin/env python from clorm import monkey; monkey.patch() # must call this before importing clingo from clorm import Predicate, ConstantField, IntegerField, FactBase from clorm import ph1_ from clingo import Control ASP_PROGRAM="quickstart.lp" #-------------------------------------------------------------------------- # Define a data model - we only care about defining the input and output # predicates. #-------------------------------------------------------------------------- class Driver(Predicate): name=ConstantField class Item(Predicate): name=ConstantField class Assignment(Predicate): item=ConstantField driver=ConstantField time=IntegerField #-------------------------------------------------------------------------- #
def setUp(self): monkey.patch() # must call this before importing clingo
#!/usr/bin/env python #-------------------------------------------------------------------------- # Clorm can "monkey patch" the official clingo library. This will replace the # clingo.Control class with clorm.clingo.Control. # -------------------------------------------------------------------------- from clorm import monkey monkey.patch() # must call this before importing clingo from clorm import Predicate, ConstantField, IntegerField, FactBase from clorm import ph1_ from clingo import Control # Import clingo.Control instead of clorm.clingo.Control ASP_PROGRAM = "quickstart.lp" #-------------------------------------------------------------------------- # Define a data model - we only care about defining the input and output # predicates. #-------------------------------------------------------------------------- class Driver(Predicate): name = ConstantField class Item(Predicate): name = ConstantField