#!/usr/bin/python 
import sys

logLabHome = 'c:\\Users\\MikeSteglich\\Documents\\Programme\\LogisticsLab-5-0-0-beta-6\\'

#logLabHome = "C:\\Users\\MikeSteglich\\Documents\\Projekte\\LogisticsLab\\DSS-Logistics\\src\\Applications\\TSP\\Win64\\Debug\\..\\..\\..\\..\\..\\"

sys.path.append(logLabHome)


from CmplApps import Cpp as cpp


#edges = [[1, 2], [2, 3], [2, 6], [3, 8], [5, 4], [5, 10], [6, 5], [6, 8], [6, 9], [7, 9], [8, 7], [9, 10]]
#weights =[29400, 25700, 12600, 12200, 12400, 10700, 28700, 26600, 10500, 28300, 11400, 26900]
#types = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]

edges = [[1, 2], [2, 3], [2, 6], [3, 4], [3, 7], [4, 5], [4, 8], [5, 3], [5, 7], [5, 8], [5, 10], [6, 3], [6, 4], [7, 10], [9, 10], [9, 11], [9, 12], [10, 12], [12, 11]]
weights = [416, 540, 437, 785, 412, 712, 396, 445, 559, 886, 1339, 759, 574, 782, 1093, 1558, 1444, 513, 509]
types = [1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1]

startNode=7
mipGap = 0.0

import sys
sys.path.append(logLabHome)
from CmplApps import Cpp as cpp
try:
    m =cpp.Cpp(edges, types, weights, startNode , mipGap, logLabHome)
    m.solve()
    if m.isEulerTour():
        eulerTour = m.getEulerTour()
        lenTour = len(eulerTour)
        edgeUsages = m.getEdgeUsages()
except cpp.CppException as e: 
    cppOK = False
    cppMsg = e
except:
    cppOK = False
    cppMsg = str(sys.exc_info())
else:
    cppOK = True
    cppMsg = "OK" 

print (cppMsg)
print(eulerTour, edgeUsages )