[AccessD] miracle required apparently

Steve Schapel steve at datamanagementsolutions.biz
Tue Oct 17 22:54:08 CDT 2023


Very good, Paul.

But if it's true that the puzzle was first formulated by Albert 
Einstein, I guess the first attempts at solving it were unlikely to be 
in an Access query or VBA function.  😁  So Stuart's pen and paper might 
be the purist approach.

Regards
Steve


On 18/10/2023 3:47:50 pm, "Paul Wolstenholme" 
<Paul.W at industrialcontrol.co.nz> wrote:

>Stuart,
>
>You are the first person I know of to try that without a computer.
>
>I'm not sure I can add much to your solution.  I expect I started the main
>query in a qbe grid but not all the logic is easy to express that way.
>The next step is to switch to SQL view and expand on the WHERE clause by
>hand with your logic properly formatted (knowing that a save in Access will
>trash the formatting - so do keep a formatted copy that is readable by
>humans elsewhere).
>
>As you are probably aware, your WHERE clause can use pretty much any
>statements and any levels of parentheses you like that makes sense to you.
>It doesn't need to be entered in canonical form - Access does that
>conversion internally.
>
>To take this further you could include preferences by creating a quality
>field to sort on and selecting the top results.
>
>Paul Wolstenholme
>
>
>On Wed, 18 Oct 2023 at 14:21, Stuart McLachlan <stuart at lexacorp.com.pg>
>wrote:
>
>>  I used to do those logic problems all the time with pen and paper.
>>
>>  That one is pretty simple.
>>  Every value of every parameter is named
>>  A 5x5 grid and simple case of deduction/elimination.
>>😀
>>
>>  On 18 Oct 2023 at 12:10, Paul Wolstenholme wrote:
>>
>>  > There is a similar problem at
>>  > https://www.rd.com/article/einsteins-riddle-solve-it/
>>  >
>>  > I had a colleague who wrote code (probably in C or a derivative) that
>>  > took about a day to execute in 1999 and gave an answer. I wrote an
>>  > Access 95 query that took about a second to reveal the possible
>>  > variations that are encompassed in the ambiguities of the problem
>>  > statement.
>>  >
>>  > My technique was first to form a table of all the permutations (in
>>  > this case of 5 things, meaning 120 entries). Next I formed a query for
>>  > each thing that could lie in any of those permutations. Finally I
>>  > formed a query that started as the cross product of each of those
>>  > queries but was linked according to the rules of the problem. (After
>>  > that I showed the final query's results in a form).
>>  >
>>  > I expect my former colleague is still plotting his revenge.
>>  >
>>  > Paul Wolstenholme
>>  >
>>  > On Wed, 18 Oct 2023 at 08:14, Paul Hartland via AccessD <
>>  > accessd at databaseadvisors.com> wrote:
>>  >
>>  > > I don't have much time until the weekend for knocking up a quick
>>  > > test, but think that scenario is pretty doable with 4 lots of times,
>>  > > 4 lots of classes, upto 8 participants and not being the same time
>>  > > or class zone more than once
>>  > >
>>  > > Paul
>>  > >
>>  > > On Tue, 17 Oct 2023, 02:22 Steve Schapel, <
>>  > > steve at datamanagementsolutions.biz>
>>  > > wrote:
>>  > >
>>  > > > Hi all
>>  > > >
>>  > > > I'm trying to do something that I initially thought would be
>>  > > > reasonably easy.  But alas, so far success has eluded me.  Any
>>  > > > insights accepted with much gratitude!
>>  > > >
>>  > > > The goal:  Assign a number of Participants to a number of
>>  > > > Activities over a number of Sessions.
>>  > > >
>>  > > > Very simple example:
>>  > > >      4 Sessions
>>  > > >      4 Activities
>>  > > >      8 Participants (therefore 2 per Activity)
>>  > > >
>>  > > > To illustrate:
>>  > > > Let's say the sessions are 9am, 10am, 11am, 12pm.
>>  > > > Let's sat the activities are chess, tai chi, bowls, diving
>>  > > > Let's say the participants are A, B, C, D, E, F, G, H
>>  > > >
>>  > > > The stipulation is that each participant should do each activity
>>  > > > one time.
>>  > > >
>>  > > > By trial and error brute force, I know that there is at least one
>>  > > > solution, namely:
>>  > > >
>>  > > >                       chess       tai chi       bowls
>>  > > >                       diving
>>  > > >    9am           A & E        C & F        D & G        B & H
>>  > > > 10am           C & G       A & H       B & E         D & F
>>  > > > 11am           D & H      B & G        A & F         C & E
>>  > > > 12pm           B & F       D & E        C & H        A & G
>>  > > >
>>  > > > HOWEVER, I have tried multiple angles of looping through nested
>>  > > > (and sometimes randomised) recordsets based on the core data
>>  > > > elements (sessions, activities, and participants), to write the
>>  > > > assignments to the available slots in a schedule table, and to my
>>  > > > shock (and horror) we always reach the point in the procedure
>>  > > > where it gets stuck, due to trying to assign a participant to two
>>  > > > activities in the same session, but with no valid alternative slot
>>  > > > available.
>>  > > >
>>  > > > There is no problem if the model calls for the super simple option
>>  > > > of only one participant for each activity.  But otherwise, no
>>  > > > dice, so far.
>>  > > >
>>  > > > There MUST be a way to make this work?  Surely?
>>  > > >
>>  > > > Thanks a lot.
>>  > > >
>>  > > > Regards
>>  > > > Steve
>>  > > > --
>>  > >
>>  > >
>>  > --
>>  > AccessD mailing list
>>  > AccessD at databaseadvisors.com
>>  > https://databaseadvisors.com/mailman/listinfo/accessd
>>  > Website: http://www.databaseadvisors.com
>>  >
>>
>>
>>  --
>>  AccessD mailing list
>>AccessD at databaseadvisors.com
>>https://databaseadvisors.com/mailman/listinfo/accessd
>>  Website: http://www.databaseadvisors.com
>>
>--
>AccessD mailing list
>AccessD at databaseadvisors.com
>https://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com


More information about the AccessD mailing list