import os 
import shutil
import time

from random_lp.lp_random_gen import RandomLP

DIR = 'TEST_DATA' + "/" + time.strftime("%d_%m_%Y")


def getPath(filename = "", directory = ""):
    return DIR + "/" + directory + "/" + filename
DIR

shutil.rmtree(DIR, ignore_errors=True)

os.makedirs(getPath(directory = "DENSE"))

# create dense random binary Linear Programs
# we want up to 33 qubits since  ibmq_qasm_simulator has 32
max_qubits = 32
var = 3
while True:
    cstr = int(var / 2)
    lp_bin = RandomLP.create_random_binary_prog("test_" + str(var), cstr, var)              
    lp_bin.write_to_lp_file(getPath(lp_bin.name, directory = "DENSE"))
    if lp_bin.complexity() > max_qubits :
        print(var)
        break
    var = var + 2

lp_bin.qubo.to_docplex().prettyprint()

