# Tag Info

5

There are methodologies to deal with problems that we do no know how to solve. Let us give it a try. First of all, let us come up with an utility function. The idea is that we should be able to feed a possible solution to the problem to the utility function, and it will return a value that tells us an estimation of how good that solution is. We will have an ...

2

The problem you are describing is the hitting set problem, and as you suggest is closely related to the set cover problem. Finding a hitting set is NP-hard, so it is no surprise that your implementation will be slow as the number of elements rises! You can approximate the solution with various approaches such as a greedy algorithm, but this is very much a ...

2

Perhaps I have a more elegant solution for you, based on my understanding of the problem. Do not hesitate to tell me if I'm off. Optionally, you can have your pipelines in a standalone git project. Don't do that if it's too difficult to detangle dependencies, but it may make sense. Store the git tag or commit id corresponding to the pipeline version inside ...

1

If you can get your decimals less than zero into integer reciprocals, then this is Least Common Multiple, and factors of that.  (Integers greater than 1 already yield integers). The reciprocal of 0.1 is 10, and of 0.0625 is 16. (160/10 is the same as 160*0.1) LCM of 10 and 16 is 80, so 80, 160, 240, all will work. To get a number like 0.4's reciprocal into ...

1

Multiply by 10^x so that all numbers are integers and then divide by the greatest common divisor (gcd). There are plenty of answers which describe how to find the latter. The resulting ratio 10^x/gcd is your multiple. If you want to ensure that the ratio is also an integer, include 10^x as one of the numbers that you are finding the gcd of.

1

With those rules in effect, all nodes in a cycle reduce to one node. Which implies you are looking for an algorithm to produce a tree from the graph. Look for all terminal nodes. Group by label and reduce them down to a single node. These are your irreducible sub-trees. Find the roots of each terminal and irreducible sub-tree (can be done one sub-tree at a ...

1

OP asks: Given that the underlying collection is a shared resource, won't the producer and consumer threads be able to simultaneously access and modify the (shared) collection? Is this the right assumption and is the quoted description therefore wrong? Your observation is correct--that nothing in the code for producer and consumer will prevent simultaneous ...

1

Pick your priorities Participants express their track preferences arranging them in order and submitting them at a certain recorded time (which is useful for prioritizing earlier submissions) You've got a conflict (or at the very least an undefined order) of priorities here. Are you primarily assigning tracks based on maximizing the attendees' cumulative ...

1

I think that Integer Linear Programming could be a good fit for this problem. With this approach, you would just need to formulate your problem as an ILP problem. You could then hand it off to an ILP solver. With this approach, it should be possible to encode different constraints on the solution. In particular, let P be the set of participants, and T be the ...

Only top voted, non community-wiki answers of a minimum length are eligible