How could we manage to import into a hg repo the differences of two repos.
I mean, say we have repo A, A2 and B. I would like to import to repo B(same file structure than A) the differences between A2 and A (A2 is just A with some changes).
I guess we should generate a diff between both directories and use hg import, but how should the diff be generated?
is there a better way to do this?
If B is totally equal to A you can (in B) just pull from A2
If B also differ from A, you can:
pull A from A2 (get additional head in A2 as result)
save diff of heads in A2 into file
import result of previous operation into B
And, BTW, you can streamline your current exotic workflow
Related
Given 3 vectors variables of the same length (let's say A, B, and C), is there a way in Minizinc to apply a search strategy on one of them(let's say B), and at each variable of B instantiated, the search goes to the variables in the same position in A and C?
E.g: A =[a1,a2,a3], B=[b1,b2,b3], C=[c1,c2,c3]
I want a search like this:
search on B with some criteria (e.g: first fail, to be sure that we're not going in order)
find the next variable to assign (b2)
assign values to a2 and c2 (same position/same index of b2)
continue the search on B etc...
Complex search heuristics are generally not supported in MiniZinc in general. However, your description of the search might be close to priority search: a search mechanism published for the Chuffed solver.
You can find a description of priority search in the following workshop paper: https://ozgurakgun.github.io/ModRef2017/files/ModRef2017_PrioritySearchWithMiniZinc.pdf
Excel formulas are often linked with each other.
Example:
As you can see, there is data labelled α-ε.
The final result is some function that is depending on α-ε.
f(α,β,γ,δ,ε) = g(α,β,γ,δ,ε) / h(α,β,γ,δ,ε)
Now I'd like to see how changing α (or β) impacts the final result. To do this, I could use the scenario manager, but I'd like to do a do it with VBA.
The problem is, I don't know the final function! I know that the function is something like =SUM(.....)/PRODUCT(PRODUCT(SUM(...))..), but to produce the output I'd need to have the full function in some VBA-comprehensive form.
To do this, one could see it as a tree. Root being my total, every sub-calculation is a root-child. Every sub-calculation in these childs is yet another child. And by somehow putting all the leafs of the tree together, you could find out the final enormous function.
Does anyone have an idea on how to tackle this problem?
EDIT: Some more info on what I meant:
Say E3 as my output has the function =SUM(E4;E5).
It is the root of our tree. Now we take a look at all of its components: E4 and E5. Let us do that:
Say E4 as has the function =PRODUCT(2;2).
Say E5 as has the function =SQRT(3).
My question: How do I get a formula that instead of saying
=SUM(E4;E5)
it says
=SUM(PRODUCT(2;2);SQRT(3))
If I have just one sig A and want to chain multiple instances of it (for example by a successor relation), Alloy will number them (A1, A2, A3 ,...) randomly.
Is there a way to tell it, that I want these in ascending order ?
Or that A3 has to come after A1, but A2 before A4 or similar constraints.
If your goal is to impose a total order on A then I would suggest using the util/ordering library:
open util/ordering[A]
If you use this library then the Analyzer will do its best to keep the A atoms in ascending order (according to the next relation that is declared in the library, meaning that A$1.next will be A$2 and so on). Also, analysis will be more efficient due to improved symmetry breaking. However, you need to be aware that signature A will become fully saturated, in the sense that a scope of 5 A will be the same as exactly 5 A.
There is no way of connecting names of sig instances to whatever relation you defined in your model (be it with your "chaining relation" or util/ordering library), in the general case. (Essentially, this is up to Alloy's solver which might instantiate fresh names unpredictably.)
One alternative, that could perhaps work in your case, might be to declare multiple sigs, for example:
one sig A1, A2, A3, ... extends A {}
with a "chaining relation":
succ = A1 -> A2 + A2 -> A3 + ...
Now, since the ordering is fixed explicitly on signatures with names, that are ordered, the models found by Alloy will indeed satisfy your desired property.
I have a file that is all strings and I want to loop through the file and check its contents against another file. Both files are too big to place in the code so I have to open each file with open method and then turn each into a loop that iterates over the file word for word (in each file) and compare every word for every word in other file. Any ideas how to do this?
If the files are both sorted, or if you can produce sorted versions of the files, then this is relatively easy. Your simplest approach (conceptually speaking) would be to take one word from file A, call it a, and then read a word from file B, calling it b. Either b is alphabetically prior to a, or it is after a, or they are the same. If they are the same, add the word to a list you're maintaining. If b is prior to a, read b from file B until b >= a. If equal, collect that word. If a < b, obviously, read a from A until a >= b, and collect if equal.
Since file size is a problem, you might need to write your collected words out to a results file to avoid running out of memory. I'll let you worry about that detail.
If they are not sorted and you can't sort them, then it's a harder problem. The naive approach would be to take a word from A, and then scan through B looking for that word. Since you say the files are large, this is not an attractive option. You could probably do better than this by reading in chunks from A and B and working with set intersections, but this is a little more complex.
Putting it as simply as I can, I would read in a reasonably-sized chunks of file A, and convert it to a set of words, call that a1. I would then read similarly-sized chunks of B as sets b1, b2, ... bn. The union of the intersections of (a1, b1), (a1, b2), ..., (a1, bn) is the set of words appearing in a1 and B. Then repeat for chunk a2, a3, ... an.
I hope this makes sense. If you haven't played with sets, it might not, but then I guess there's a cool thing for you to learn about.
I found the answer. There is a pointer when reading files . The problem is that when using a nested loop it doesn't redirect back to the next statement in the outer loop for Python.
This is what I want to do:
In previous work, I made some calculation and have the result (left part of the image) and now I want to use it somewhere else. The problem is that the value that I want to reuse is a combination. In my example, I have to reference both "No.8"'s M value and V value. I have to type =C30 and =C38 to reference them.
If there a way, having referenced the first one=C30, to reference the V relative to the M, something like =C(30+8) (because the relevant V is 8th down from M)?
With a couple of named ranges (say arM for A30:C37 and arV for A38:C45) and assuming the output array is labelled as shown, where shown, then in J34 copied across and down:
=VLOOKUP($H$34,INDIRECT("ar"&$I34),RIGHT(J$33)+1,0)