Viewing 15 posts - 31 through 45 (of 76 total)
DROP TABLE #T;
CREATE TABLE #T(Col1 INT)
INSERT INTO #T
SELECT 1 UNION ALL
SELECT 1 UNION ALL
SELECT 2 UNION ALL
SELECT 3 UNION ALL
SELECT 4 UNION ALL
SELECT 1
--SELECT SUM(DISTINCT(Col1)) AS 'Sum of distinct values',SUM(Col1)...
June 26, 2012 at 3:50 pm
Here's the entire SQL set that solves the challenge using negation. SW1.doc and SW2.doc are separated versions of the previous attachment. I can now process the entire set in under...
June 26, 2012 at 3:27 pm
For those who want to explore this a bit further, I'm attaching the SQL that JC provided to create the 'Sweden' table, and a 'Map' table to associate all old...
June 26, 2012 at 9:29 am
FWIW, with some interesting results, I did solve the challenge, but ironically, it was with my original SQL on a screaming database server using the divide and conquer method. What...
June 25, 2012 at 12:01 pm
>>Les - One other thing. Would you mind posting your final row counts (input and output), CPU and elapsed times to solution?
Will do. It's still running. If it doesn't...
June 23, 2012 at 4:20 pm
After putting the route issue to bed, I was mulling over how well this performed. So, to escalate its application, I tossed this at the Jan. '98 Dr. Dobbs...
June 22, 2012 at 5:01 pm
Thanks folks. Brilliant! It made mincemeat out of the Route problem. It worked so well though that I'm now tossing it at a much bigger NP problem that we attempted...
June 22, 2012 at 10:44 am
Sheesh...quite the brain trust up here. It's going to take me a bit to wade through these. I'll report the results after I come up for air 🙂
~Les
June 20, 2012 at 10:07 am
Chris,
Oddly...I haven't seen that one. Any idea where I might track it down?
~Les
June 19, 2012 at 3:56 pm
So, the permutation count for David's scenario is 50*49*48*47*46 = 50!/45! = 254,251,200
That would leave 120 (5*4*3*2*1) permutations for each distinct combination, so the combination count = 50!/(45!*5!) = 2,118,760...
June 19, 2012 at 3:46 pm
>>Is there adjacency data missing from the description?
The adjacencies have already been resolved.
Thx,
~Les
June 19, 2012 at 3:01 pm
>>And so, a link to Hugo Kornelis's bin packing series, which may spark an idea or 2.
Thanks. It does have similarities. I'll have to give it a thorough read.
June 19, 2012 at 2:58 pm
Lynn,
It's a redistricting (route) requirement, where we're looking to contain each district to roughly the same number of meters (service locations). Urban growth and all that.
June 19, 2012 at 1:23 pm
>>All the possible combinations of those rows that added to 5?
All the possible DISTINCT combinations.
~Les
June 19, 2012 at 1:20 pm
G[]...
I'd come to the same conclusion, but thought it might be worth a toss up here. I thumbed through all of Celko's books, but nothing jumped out. Intuitively I think...
June 19, 2012 at 1:03 pm
Viewing 15 posts - 31 through 45 (of 76 total)