def __init__(self, formula, solver='g3', adapt=False, exhaust=False,
            incr=False, minz=False, trim=0, verbose=0):
        """
            Constructor.
        """

        # saving verbosity level and other options
        self.verbose = verbose
        self.exhaust = exhaust
        self.solver = solver
        self.adapt = adapt
        self.minz = minz
        self.trim = trim

        # clause selectors and mapping from selectors to clause ids
        self.sels, self.smap = [], {}

        # other MaxSAT related stuff
        self.topv = formula.nv
        self.wght = {}  # weights of soft clauses
        self.sums = []  # totalizer sum assumptions
        self.bnds = {}  # a mapping from sum assumptions to totalizer bounds
        self.tobj = {}  # a mapping from sum assumptions to totalizer objects
        self.cost = 0

        # mappings between internal and external variables
        VariableMap = collections.namedtuple('VariableMap', ['e2i', 'i2e'])
        self.vmap = VariableMap(e2i={}, i2e={})

        # initialize SAT oracle with hard clauses only
        self.init(formula, incr=incr)

        # core minimization is going to be extremely expensive
        # for large plain formulas, and so we turn it off here
        wght = self.wght.values()
        if not formula.hard and len(self.sels) > 100000 and min(wght) == max(wght):
            self.minz = False
def __init__ ( self , formula , solver = 'g3' , adapt = False , exhaust = False , incr = False , minz = False , trim = 0 , verbose = 0 ) : self . verbose = verbose self . exhaust = exhaust self . solver = solver self . adapt = adapt self . minz = minz self . trim = trim self . sels , self . smap = [ ] , { } self . topv = formula . nv self . wght = { } self . sums = [ ] self . bnds = { } self . tobj = { } self . cost = 0 VariableMap = collections . namedtuple ( 'VariableMap' , [ 'e2i' , 'i2e' ] ) self . vmap = VariableMap ( e2i = { } , i2e = { } ) self . init ( formula , incr = incr ) wght = self . wght . values ( ) if not formula . hard and len ( self . sels ) > 100000 and min ( wght ) == max ( wght ) : self . minz = False
Constructor.