Note that there are some explanatory texts on larger screens.

plurals
  1. POfast and simple constraint programming involving vectors (arrays)
    primarykey
    data
    text
    <p>I have many,many, many vectors that I need to check for duplicates of numbers with some very basic first order logic.</p> <p>I can use intersections, but that is proving to be too slow. I thought I could turn this into a bitwise problem. The full set of integers are known and each vector/array could be represented as a bitset, but I can only find a half a solution.</p> <p>I currently use looping and vector intersection but it is proving to be too slow for the amount of problems I need to check.</p> <p>For a simple example, given:</p> <pre><code>E: 1 2 F: 2 4 M: 1 3 N: 4 5 A: 5 6 </code></pre> <p>The problem I am trying to identify, is always a larger format of:</p> <pre><code>(E || F) &amp;&amp; (M || N) &amp;&amp; A -&gt; which is proven as possible by selecting F,M,A. </code></pre> <p>I need to verify if the above is possible without duplicates.</p> <p>Is there a means of examining vectors/arrays like this that is faster than 9 million loops? Are the constraint libraries the only option?</p> <p><strong>In an effort to clarify:</strong></p> <p>containers are std::vector. </p> <p>The vectors contain any integer. </p> <p>I would need to examine them problem by problem to identify the full set of integers.</p> <p>Using the conditional logic specified to select entire vectors, will a duplicate occur? The conditional operators in use would always be "AND" and "OR" only. The problem I listed is a simplified version, but that is really all there is to it. It just differs in size.</p> <p>The output I care less about..it could be a boolean, another vector of potential duplicates, etc. I am trying to find the right tool for the job rather than salvaging.</p> <p>In my current set up, I would solve this by analyzing for forced items like A and removing anything it intersects with...(in this case, N...then I would loop again, and do the same process with M, which is now a forced choice, and removing E, leaving me with F.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload