Re: Demo: Modelling Cost of Travel Paths Between Towns

From: Ed prochak <ed.prochak_at_magicinterface.com>
Date: 8 Nov 2004 11:32:28 -0800
Message-ID: <4b5394b2.0411081132.41b7a32a_at_posting.google.com>


neo55592_at_hotmail.com (Neo) wrote in message news:<4b45d3ad.0411071807.4cbd51f0_at_posting.google.com>...
> www.xdb2.com/Example/Ex112.asp demos how to represent things needed to
> calculate the cost of traveling between any two towns via multiple
> paths. The example allows the path between any two towns to be uni or
> bi-directional. The example allows the specification of travel cost
> during any time period of each weekday.
>
> More specifically, the example represents the following things: Four
> towns named a, b, c, d (imagine them forming a square). There are
> paths from a to b, b to c, c to d and d to a. There are also opposite
> paths from a to d, d to c, c to b and b to a. In addition, there are
> two uni-directional cross paths, one from a to c and the second from b
> to d. The cost of travel from town a to town b on Monday between 00:00
> and 24:00 is 1.00.

Incomplete problem description. What is the costs for travel on other days?

>
> The script below stores above things:
>
> // Create towns a, b, c, d
> CREATE2 *town.cls = thing;
> CREATE2 *a.cls = town;
> CREATE2 *b.cls = town;
> CREATE2 *c.cls = town;
> CREATE2 *d.cls = town;
>
> // Create directional verb "to"

Documentation error. you actually created the verb "goto"

> // which leads to lower level (aka creature)
> CREATE2 *goto.cls = verb;
> CREATE2 goto.vbType = cr;
>
> // Create a square shaped graph
> // Note: outer paths are bi-dir
> CREATE2 a.goto = b;
> CREATE2 b.goto = a;
>
> CREATE2 b.goto = c;
> CREATE2 c.goto = b;
>
> CREATE2 c.goto = d;
> CREATE2 d.to = c;

Compile error. no such method as "to"
>
> CREATE2 d.goto = a;
> CREATE2 a.goto = d;
>
> // Note: inner cross paths are uni-dir
> CREATE2 a.goto = c;
> CREATE2 b.goto = d;

Actually all the so-called paths are unidirectional. You never created a bidirectional "goto" verb.

>
> // Create weekdays
> CREATE2 *weekday.cls = thing;
>
> // Create start time of day (inclusive)
> CREATE2 *start.cls = thing;
>
> // Create end time of day (exclusive)
> CREATE2 *end.cls = thing;
>
> // Create costs
> CREATE2 *cost.cls = thing;
>
> // Create it cost 1.00 to go from town a to town b
> // on monday between 00:00 and 24:00
> CREATE2 (a.goto=b).weekday = +monday;
> CREATE2 ((a.goto=b).weekday=monday).start = +00:00;
> CREATE2 (((a.goto=b).weekday=monday).start=00:00).end = +24:00;
> CREATE2 ((((a.goto=b).weekday=monday).start=00:00).end=24:00).cost =
> +1.00;

weird operators.
Based on above, is there such a thing as a negative monday? -monday.

 OR does it work like C so =+ means to add/insert/concatenate the values? In which case how do you diferentiate between straight replacement when the programmer wishes to emphasize the signed value (x=+1 "x equals a positive one") versus the addition operation (x=+1 "x incremented by one <unsigned>)?

Now that you have a design, what problems do you think you can solve with it?
(You are not really so uninformed as to suggest this might solve the travelling salesman problem, are you?)

ed Received on Mon Nov 08 2004 - 20:32:28 CET

Original text of this message