If your're doing it in Cf then sounds like you need to do it in the
database. Something like this depending what you're using.
1 Build first query for add direct links and add to a temp table.
2 Then get a query with just the departure and not destination.
3Add these to temp table or query and link by destination-to-departure to a
second query of those with destination and not departure.
4 Add this list to your original temp table.
5 To go down further levels you could repeat step 3 with an intermediate
link
(departure only) linked from destination to departure (all departures)
linked from destination to departure (destination only)
Add these to your original temp table
And so on
-----Original Message-----
From: Rob Eastland [mailto:[EMAIL PROTECTED]]
Sent: 08 February 2001 19:44
To: CF-Talk
Subject: Combinations
I've been struggling a bit with a search function.
Scenario:
I'm trying to build a search function that finds a any combinations of
voyages (seafaring shipping company client) that match the search criteria
of departure and arrival port. There is also some date qualification, but
that will just complicate the description so I'll leave that out for now.
Basically I'm trying to find a way to get combinations of voyages that meet
the search criteria without doing endless looping which has been proven to
not work without timing out.
I have all of the individual voyages in a single table with the
departure/arrival ports and dates. Finding a single voyage that matched the
citeria was simple by using a single query and outputting the results. Next,
I tried using one query to find any voyages that left from the desired
departure port and another to find any that arrived in the desired port.
Then I looped through the first set of results while looping through the
second set inside that loop and using a cfif statement to see if any two
voyages combined matched the requirements and output any true results. It's
not particularly fast, but it works.
Problem:
I tried to continue this logic with another query to get any remaining
voyages with another embedded loop an expanded logic statement to see if any
remaining voyage could connect a voyage from the first set with a voyage
from the second set. This simply times out before it can complete, and
theoretically I need to this process to continue until it finds all possible
combinations that can fit together to meet the search criteria.
It's sort of like finding a combinations of flights that could get someone
from New York to Los Angeles. He could get a direct flight, or a flight from
NY to Chicago then from Chicago to LA. Or, from NY to Chicago, Chicago to
Denver, Denver to LA. etc....
I thought the solution could be narrowing the number of comparisons by
embedding a query in the loop that just retrieved possible connections for
each departure and arrival set that it was going to compare instead of
comparing all remaining voyages for a valid connection voyage, but running
that many queries seemed to actually make it slower.
In one example I have about 30 voyages that leave from the desired departure
port and about 40 that arrive in the desired arrival port which makes about
1200 possible combinations to test. That part actually works, but when I try
to compare those to another ~150+ possible connecting voyages the number
goes up very quickly to about 180,000 comparisons and would grow
exponentially as I tried to find multiple connections, but I can't even do
that without timing out.
Any ideas would be greatly appreciated.
:--))
Rob
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
****************************************************************************
******
The opinions expressed in this E-mail are those of the individual and
not necessarily the company. This E-mail and any files transmitted
with it are confidential and solely for the use of the intended recipients
****************************************************************************
******
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists