#!/usr/bin/python 
import sys
import traceback


#logLabHome = "C:\\Users\\Mike\\opt\\LogisticsLab-5-2-0-beta\\"
logLabHome = "C:\\Users\\Mike\\Documents\\Projekte\\LogisticsLab\\DSS-Logistics\\"

sys.path.append(logLabHome)
from CmplApps import Tpp 
#from pyCmpl import CmplException


#tppFile = 'C:\\Users\\Mike\\Documents\\Data\\test\\tpp-test.TPPX' 
#tppFile = "C:\\Users\\Mike\\Nextcloud\\Aufsaetze und Buecher\\Dritte Auflage\\Modelle\\Transport\\bottleneck-zweiseitig-beschränkt.TPPX"
tppFile = "C:\\Users\\Mike\\Nextcloud\\Vorlesungen\\Winter2023\\Decision Support Systems in Logistics\\Models\\bb.TPPX"


llVersion='5.0.1'


#*************** main  *****************************************************
try:
        
    print("LogisticLab has started CMPL ")
    tpp = Tpp.TPP(logLabHome, tppFile, llVersion )
    print("... reading TPP file ")
    tpp.readTppFile()
    print("... solving problem")
    tpp.solve(timeLimit=15)
    print("... writing solution to LogisticLab ")
    tpp.writeSolFile()
    print("... done ")
                            
                
except Tpp.TppException as e:
    tppOK = False
    tppMsg = e
except: 
    tppOK = False
    tppMsg = str(sys.exc_info()[1])
    traceback.print_exc()
else:
    tppOK = True
    tppMsg = "OK" 
print(tppMsg)
        
#************** end main  **************************************************