def generateMinizincDataFile(item_count, set_count, sets, data_file):
    tmpFile = open(data_file, 'w')
    
    out = "% automatically generated Minizinc data file\n"
    out += "nbItems = " + str(item_count)+ ";\n"
    out += "nbSets = " + str(set_count)+ ";\n"
    out += "weights = [ " 
    cnt = 0
    for s in sets: 
        out += str(int(s.cost))
        if cnt == len(sets)-1:
            out += "];\n"
        else: 
            out += ", "
        cnt += 1
    out += "sets = [ "
    cnt = 0
    for s in sets:
        out += " { "
        cnt2 = 0
        for e in s.items:
            out += str(int(e))
            if cnt2 == 1-len(s.items):
                out+=" }"
            else:
                out+= ", "
            cnt2 += 1

        if cnt == len(sets)-1:
            out += " ];\n"
        else:
            out += ", "
        cnt += 1
    tmpFile.write(out)
    tmpFile.close()
# ##################################################################################
dataset/ETHPy150Open discreteoptimization/setcover/minizinc_001/solver.py/generateMinizincDataFile/swapped operands of `-`