import os 
import shutil
import time

from random_lp.random_qp import RandomQP

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

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

DIR

shutil.rmtree(getPath(directory = "DENSE"), ignore_errors=True)

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

# create dense random binary quadratic Programs
# start with 10 variables and 5 constraints
max_qubits = 200
var = 10
while True:
    cstr = int(var / 2)
    qp_bin = RandomQP.create_random_binary_prog("test_dense_" + str(var), cstr, var)              
    qp_bin.write_to_lp_file(getPath(qp_bin.name, directory = "DENSE"))
    if qp_bin.complexity() > max_qubits :
        print(var)
        break
    if qp_bin.complexity() > 100 :
        var = var + 10
    else:
        var = var + 5
    

