In CUDD, how to force a group of variables to stay at the end of the ordering? - cudd

I have two sets of variables A, B. I would like to enable reordering but ensure that at all times variables A appear before the variables of B.
I also want to allow reordering within A, and within B.
(I know how to create two groups A and B with Cudd_MakeTreeNode; my question is about ensuring that B comes last)

Related

Application of a custom function to generate iterations across a distance range

Bit of a complex query but I will try to articulate it as best I can:
Essentially I have a list of objects for which I am trying to work out the probability of said items hitting particular points below on the seabed having been dropped at the surface. So there are two steps I need guidance on:
I need to define a custom function, ERF(a,b), where I need to refer to specified values dependent on the Item Number (see in the column names) in order to then use them as multipliers:
These multipliers can be found in a dictionary, Lat_Dev (note please ignore the dataframe column reference as this was a previous attempt at coding a solution, info is now found in a dictionary format).
The function then needs to be repeated for set iterations between a & b with the step size defined as 0.1m. This range is from 0-100m. a is the lower limit and b the upper limit (e.g. a = 0.1m & b = 0.2m). This is done for each column (i.e. Item_Num).
Hopefully the above is clear enough. Cheers,

Assigning and reading multidimensional arrays in Python

I'm stumped.
for a in range(0,500): #500 is a highly variable number but using it for example purposes
b = findall(r'<(.*?)>', d) # d will return a highly number variable number of matches could be anywhere from 45-10000
c.append([b])
print(c[0][1])
This returns the error because everything from 'b' goes into c[0][0]. I can understand this. The question is how do I split 'b' apart so I can put it into c so I can
print(c[0][234])
and get it give me back the 235, err element 234 of the 1, err 0, line?
This is a situation like I said above where the number of times going through 'b' will be variable, at least for right now until I get the entire file prepped I can only that 'b' in the end will be way north of 10,000 and probably closer to 100,000 by the time I have all the data collection finished. The number of elements that are stored can and will be highly variable depending on the file that they come from. They are all coming from a csv file but I'm hoping to not to deal with adding in any 'complexity' by going out and having to deal with the csv module...since I've never used it before and that will probably just lead to more questions.
I have tried something similiar to...different variables naturally so things would be appropriately matched up
d = list(zip(*(e.split(',') for e in b)))
all this has did is split on each and every letter versus on the comma.
Your error is coming from the square brackets you have in c.append([b]). The brackets create an extra list that contains the list b. So rather than a two dimensional data structure, you're ending up with three dimensions. Your indexing fails because c[0][1] is trying to get a second value from the middle list (which only ever has one item in it).
You might get what you want with c[0][0][1] instead. But you probably don't actually want that extra level in your data structure. You can avoid creating it by using: c.append(b)

Reducing occupied memory by multidimensional variant array in vba

I have a rather large array:
Global add_vit(0 To 6, 0 To 6, 2 To 18, 0 To 1300, 0 To 8) As Variant
Which I fill partially fill up in module a, sub one, (which takes a long time). I wish to execute Module a sub one only once.
Once the execution has finished, I want to acces the above variant array in module b, sub two, and run module b sub two multiple times independently, in order to verify the code I am working on in module b, sub two.
I learnt that the "Global" part means that the the array will be filled/preserved even after module a, sub one is completely finished. That is what I need, but at the same time, I run on the border of getting out of memory errors.
I have several of such arrays in run module a, sub two which are all interlinked, and in certain conditions I need specific entries to be copied to other specific entries of arrays. This also prevents me from separating the computation of this last global array into another module.
I am also confused by the perceived randomness of when a "out of memory" error occurs, when I run the same script with the same initial conditions at different times, thoug I assume it is because the amount of memory available for excel is not static, but dependent on other processes I use on my laptop simultaneously.
Does anyone have a suggestion on how to maintain the same amount of entries (for doubles and longs), (or doubles and booleans) in storage accesible, (approx. 8.000.000) whilst still being able to access them from different modules when the initial computation is finished without occupying so much memory?*
*Without manually storing them into an excel sheet for it is tedious and slows down computation drastically.
I also try to reset the entire array manually before computations with the following script:
For A = 0 To 6
For B = 0 To 5
For C = 2 To 18
For d = 0 To 1300
For e = 0 To 4
add_vit(A, B, C, d, e) = ""
Next e
For f = 6 To 7
add_vit(A, B, C, d, e) = False
Next f
Next d
Next C
Next B
Next A
Thank you for your tips!
#A.S.H Thank you I have tested and validated that indeed a public also retains it's value after the the sub/module has been completed.
So I appologize #ThunderFrame , you were right, I could use a public instead of a sub, thank you.
#user3598756 thank you, that was the statement I initially was looking for, the erase statement.
#Absinthe I forgot to mention that module 2 is actually a sub in a form that is generally called with userfomX.show, I still have to look up how the variables are passed through to that. But mainly the separation of the two modules was what I was looking for, which meant that I wanted to run module 2 without needing to run module1 everytime whilst still using the stored output of a single run of module one.
Thank you so much everyone, you are awesome!

Pivot count names by groups

I have a PivotTable with a variety of personal names, you can then expand each person to find out if he is A, B, C , A and B, A and C , or B and C.
I want the number of A and B's specific, not just how many people have two letters.
So how I count the number of A and B , A and C's , and B and C's ?
Create a separate pivot table and put your field which contains {A,B,C,D} into the Row Labels and Values fields
Taking your comment into consideration, I think what you want is the count of people numbers by category (ie assumes each person fits into only one type, even though the type may be 'compound'), for example:
where the left-hand columns represent your existing PivotTable. You might be able to achieve this result with a different view from your existing PT.

How to store an object and its row/column position + have an index

I am making a space invaders game. Each invader has its position on the screen stored. This would form a nice grid of 5 rows with each 11 invaders.
There are 3 types of invader A, B, and C. A consists of 22 invaders, B also, and C 11. Because of this I could not use their positions alone to form the grid on the screen. So, I added variables for how many rows and columns there are and with these I could use a nested for loop to get the right amount of invadertypes.
Now, I have an idea for some kind of algorithm to get them to do something, but for that I need to store them in a certain way. How I'm thinking of doing it is to use a Dictionary<int, Tuple<Point, Invader>>, where int will be the index like in a list, Point will be used for storing row-column, and Invader for well, the invader.
Before I used a List to store invaders and so I could with a for loop access the invader I needed to perform an operation on. Like invaders[i].DoSomething().
I want to be able to still do that, and have not only the invader, but also what row-column it is occupying.
What are my options?
Why not add row / column variables to your invader class?

Resources