# Path: clara/common.py
# def debug(msg, *args):
#     if args:
#         msg %= tuple(args)
#     print('[debug] %s' % (msg,), file=DEBUG_DEST)
# 
# Path: clara/model.py
# SPECIAL_VARS = set([VAR_COND, VAR_RET, VAR_IN, VAR_OUT])
# 
# Path: clara/repair.py
# class Timeout(Exception):
#     pass


import time
from .common import debug
from .model import SPECIAL_VARS
from .pylpsolve import LpModel, EQ, LE, GE, TIMEOUT, SUBOPTIMAL, NUMFAILURE
from .repair import Timeout
                    self.R[ri] = (loc1, var1, var2, cost, order, idx)
                if len(RV) and var1 != '-':
                    # sum ri >= 1
                    # At least one ri for (loc1,var) should be chosen
                    self.C.append((RV, EQ, 1))

    def build_model(self):
        # Init model
        self.LP = LpModel(cols=self.N)
        if not self.verbose:
            self.LP.setverbose(1)

        # Bound variables
        for i in range(1, self.N + 1):
            self.LP.setint(i, 1)
            self.LP.setupbo(i, 1.0)

        # Set objective function
        self.LP.setobjfnex(self.O)

        # Add constrains
        self.LP.setaddrowmode(1)
        for (left, op, right) in self.C:
            self.LP.addconstraintex(left, op, right)
        self.LP.setaddrowmode(0)

    def solve_model(self, scaling=0):

        scalings = [4, 0, 1, 2, 3, 7]
        if self.verbose:

# Path: clara/common.py
# def debug(msg, *args):
#     if args:
#         msg %= tuple(args)
#     print('[debug] %s' % (msg,), file=DEBUG_DEST)
# 
# Path: clara/model.py
# SPECIAL_VARS = set([VAR_COND, VAR_RET, VAR_IN, VAR_OUT])
# 
# Path: clara/repair.py
# class Timeout(Exception):
#     pass


# Path: clara/ilp.py
import time
from .common import debug
from .model import SPECIAL_VARS
from .pylpsolve import LpModel, EQ, LE, GE, TIMEOUT, SUBOPTIMAL, NUMFAILURE
from .repair import Timeout

                    self.R[ri] = (loc1, var1, var2, cost, order, idx)
                if len(RV) and var1 != '-':
                    # sum ri >= 1
                    # At least one ri for (loc1,var) should be chosen
                    self.C.append((RV, EQ, 1))

    def build_model(self):
        # Init model
        self.LP = LpModel(cols=self.N)
        if not self.verbose:
            self.LP.setverbose(1)

        # Bound variables
        for i in range(1, self.N + 1):
            self.LP.setint(i, 1)
            self.LP.setupbo(i, 1.0)

        # Set objective function
        self.LP.setobjfnex(self.O)

        # Add constrains
        self.LP.setaddrowmode(1)
        for (left, op, right) in self.C:
            self.LP.addconstraintex(left, op, right)
        self.LP.setaddrowmode(0)

    def solve_model(self, scaling=0):

        scalings = [4, 0, 1, 2, 3, 7]
        if self.verbose:

            debug('setting scaling=%d', scalings[scaling])