I'm currently trying to use pysat to solve some k-colorability problems I have. The problem I'm having is a have a CNF formula (a list of lists) of the form:
[1 2 3 4 5 6 7]
[8 9 10 11 12 13 14]
...
[71 72 73 74 75 76 77]
[-60 -80]
[-61 -81]
...
So I have two groupings of array lengths, each can be tens of thousands of lines long, to where it can no longer fit in RAM.
What I tried to do is create two numpy lists using memmap
list1 = np.memmap('temp', dtype = 'float', mode = 'w+', shape = (a, b))
# Fill up list1 with values
list1 = np.memmap('temp', dtype = 'float', mode = 'w+', shape = (c, d))
# Fill up list2 with values
Then run the solver:
with Solver(name=solver_name, bootstrap_with=np.concatenate((list1, list2)), use_timer=True) as s:
# Setting up timers and other code
Of course, this approach doesn't work and gives me the error message:
ValueError: all the input array dimensions except for the concatenation axis must match exactly
Is there any way I can create a jagged array of arrays stored to disk? Or concatenate two different lists of lists of different shapes that have been stored to disk together to pass into this solver?
Sorry if this is a duplicate. I looked at some of the other questions and couldn't find one that matched my situation.
question from:
https://stackoverflow.com/questions/65601785/concatenate-two-memmapped-numpy-arrays-of-different-sizes-together-python 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…