1. More printf problems 2

--=====================_879189795==_

I tried to attach a message to a brief introduction a couple of minutes ago,
and dropped the ball, so nothing was attached.  Here we go again; I hope it
works this time.

Wally Riley
wryly at mindspring.com

--=====================_879189795==_

Hello everybody -

Thanks to extensive help from Bob Pilkington and Ralf
Nieuwenhuisen, my big program is running now, and it generates
the 'progsig' outputs more or less satisfactorily..  It is a
version of Art Adamson's traveling salesman program.  I changed
the 'progsig' interval so it is now generated every 10 minutes
instead of every minute.  Eventually I hope to remove it
altogether.

However, there is still something missing in my understanding of
the 'printf' command, because I'm not getting any printed output
at all.  Ordinarily I wouldn't want much, but I do want enough at
the present debugging stage to disclose any bugs.  I'm left
completely in the dark.

I changed the program to work with a smaller collection of cities
(18 instead of 48), which should produce some kind of output on
the screen from time to time, and a printed message at longer
intervals.  I'm getting neither.  I added a short routine that
should print out a list of the cities in their current order at
frequent intervals, whenever the program enters a particular
subroutine, and I'm getting exactly nothing -- zero -- nada --
zilch.  Here is the short routine:

temp = open("PRN", "w")
printf("temp", "%s\n", {"newTrip[1..9]})
printf("temp", "%s\n", {"newTrip[10..18]})
printf("temp", "%d\n\n", {count})
close("temp")

The 18 states that should print out in two lines are, basically,
the northeastern states of the U.S. plus all the states north of
the Ohio River and east of the Mississippi River.  Need a list?
Here they are: ME, NH, VT, MA, RI, CT, NY, NJ, DE, MD, VA, WV,
PA, OH, IN, MI, WI, IL.  This is the initial order with which the
main program begins; it should juggle the order, display any new
order on the screen (now temporarily on the printer -- that
doesn't work either) and if the new order has a shorter total
distance, print that order on paper.  The distance is the sum of
the distances between the capitals of those states -- hence the
resemblance of this program to the classic traveling-salesman
problem.

The object of the main program is to find a minimum-length tour
(or almost minimum-length) of all 48 contiguous states of the
U.S., subject to the restriction that each leg of the tour passes
between adjoining states only.  It is supposed to approximate the
true minimum length only; the absolute minimum would take
hundreds of years to compute.  There are a number of other
restrictions that follow from the adjoining requirement; I won't
go into them now, because this is supposed to be a short note.

There was an article about this project in the Amateur Scientist
section of Scientific American last March.  That article
described an algorithm in C; Art Adamson revised the program in
Euphoria and has recently produced an improved version, together
with one from someone in Eastern Europe who doesn't know English,
and whose program therefore I haven't yet been able to unravel.

If you need additional information about this, some of it is
available on the Euphoria Listserv (Art's two versions) or
directly on the Internet (from the Society of Amateur
Scientists).  If I can help you by describing parts of it, let me
know.  If you really, *really* want to see my entire program,
just ask; but it's a monster (eleven pages printed out) so I
won't send it unless you absolutely, positively have to see it.
My "short" version is also eleven pages, but it works with a
smaller data base and is shorter in that respect only.

Again, I'm reasonably sure that the hangup is in my use or misuse
of the 'printf' command.  There's something about it that I don't
quite understand.  I hope somebody can ferret it out.  Thanks in
advance.

Wally Riley
wryly at mindspring.com

--=====================_879189795==_--

new topic     » topic index » view message » categorize

2. Re: More printf problems 2

Wallace B. Riley wrote:

> Thanks to extensive help from Bob Pilkington and Ralf
> Nieuwenhuisen, my big program is running now, and it generates
> the 'progsig' outputs more or less satisfactorily..  It is a
> version of Art Adamson's traveling salesman program.  I changed
> the 'progsig' interval so it is now generated every 10 minutes
> instead of every minute.  Eventually I hope to remove it
> altogether.

Almost Nieuwenhuijsen, but it really doesn't matter, nor will i be
insulted.BTW I hope Pete suggestions work, i suppose the euphoria
documentation could be better, althrough i dunno any language that is
this well documented, we ussually buy a book or get one from the library
for those other language, cause the reference manuals are too techical.

Also guess who has been interested in this problem some years ago and
come up with some very complex sollutions or i think even *the* solution
(used at this point) ???

Robert Craig did...

Seriously, I am offcourse not sure if it was the same, but i say his
name on some page that was also about this problem and they stated (i
believe) that some suggestions of Robert Craig have lead to the way we
try to solve this problem now.
Maybe he knows more..

Ralf N
nieuwen at xs4all.nl

new topic     » goto parent     » topic index » view message » categorize

3. Re: More printf problems 2

Ralf speculated:
> Seriously, I am offcourse not sure if it was the same, but i say his
> name on some page that was also about this problem and they
> stated (i believe) that some suggestions of Robert Craig have
> lead to the way we try to solve this problem now.

It must have been some other Robert Craig.
I have never tried to solve the Travelling Salesman problem.

Regards,
     Rob Craig
     Rapid Deployment Software

new topic     » goto parent     » topic index » view message » categorize

4. Re: More printf problems 2

On Tue, 11 Nov 1997, Robert Craig wrote:

> Ralf speculated:
> > Seriously, I am offcourse not sure if it was the same, but i say his
> > name on some page that was also about this problem and they
> > stated (i believe) that some suggestions of Robert Craig have
> > lead to the way we try to solve this problem now.
>
> It must have been some other Robert Craig.
> I have never tried to solve the Travelling Salesman problem.

Geez there must be a lot of traveling salemen who use euphoria and NEED
THIS ANSWER!  Why anyone ELSE would is beyond me.  Isn't there a reference
book somewhere with the correct answer?  Just look it up. =)

Somebody write a boxing game...

Michael Packard
Thinking about choplifter...

new topic     » goto parent     » topic index » view message » categorize

5. Re: More printf problems 2

Michael Packard wrote:

> Geez there must be a lot of traveling salemen who use euphoria and
> NEED
> THIS ANSWER!  Why anyone ELSE would is beyond me.  Isn't there a
> reference
> book somewhere with the correct answer?  Just look it up. =)

    Eh.. there is no perfect answer, and i know you aren't actually
wondering why people need this, do you ??    The problem is called
Travelling-SalesMan-Problem.
    But what we really want, is an system that gives a good solution
when there are too many possibilities to check them all.

    You can't look the answer up, the solutions are getting better
everyday.
    And for you AI-man, think about the help this system can give, for a
chess-game.
    There are so many different combinations to check and value in a
short time. We need to learn that computer to see patterns and to check
very very very deep in a short time, using a good-solution instead of
perfect-solution-system.

    For somebody who is a professional programmer, your respons was
kinda weird, like you don't know...
    ..well at least, you do now.

Ralf N.
nieuwen at xs4all.nl

new topic     » goto parent     » topic index » view message » categorize

6. Re: More printf problems 2

>Somebody write a boxing game...


        Man can not live on games alone:)

Bye. Art
Arthur P. Adamson, The Cincinnati Engine Man, euclid at isoc.net

new topic     » goto parent     » topic index » view message » categorize

7. Re: More printf problems 2

On Wed, 12 Nov 1997, Arthur Adamson wrote:

> >Somebody write a boxing game...
>
>
>         Man can not live on games alone:)

yes he can... =)

new topic     » goto parent     » topic index » view message » categorize

8. Re: More printf problems 2

Michael Packard wrote:

>> Geez there must be a lot of traveling salemen who use euphoria
>and > NEED > THIS ANSWER!  Why anyone ELSE would is beyond me. =

>Isn't there a > reference > book somewhere with the correct
>answer?  Just look it up. =3D) =


Why don't you program a 'travelin-salesmen-shoot'em'up-game'?
As the salesmen become more and more intelligent, you try to block their
way and they in turn try to find the next best solution. etc, etc...
In the next stage the salesmen have to grab bulls or cows by their horns.=

The salesmen in black!

Ad

new topic     » goto parent     » topic index » view message » categorize

9. Re: More printf problems 2

At 02:01 AM 11/12/97 -0800, you wrote:

>Geez there must be a lot of traveling salemen who use euphoria and NEED
>THIS ANSWER!  Why anyone ELSE would is beyond me.  Isn't there a reference
>book somewhere with the correct answer?  Just look it up. =)
>
>Somebody write a boxing game...
>
You must be kidding.  I hope you are.  Surely you know that a complete
solution to the traveling salesman problem would take hundreds of years on
the largest imaginable supercomputer.  It's a matter of theoretical interest
only, or something for us types with hyperactive imaginations to play with.

On the other hand, it's not entirely theoretical; Dr. Shawn Carlson, in his
original Scientific American writeup last March, gave a very realistic
situation in which at least some approximation to the solution, if not a
complete solution, would be quite useful.  Hence the approach using
Simulated Annealing.

Look up that article.  It's very interesting.

Wally Riley
wryly at mindspring.com

new topic     » goto parent     » topic index » view message » categorize

10. Re: More printf problems 2

On Wed, 12 Nov 1997, Wallace B. Riley wrote:
> You must be kidding.  I hope you are.  Surely you know that a complete
> solution to the traveling salesman problem would take hundreds of years on
> the largest imaginable supercomputer.  It's a matter of theoretical interest
> only, or something for us types with hyperactive imaginations to play with.
>
But if you AREN'T a traveling salesman, why would you waste your time
trying to find an optimal solution to a problem you will never face?  And
if as you say it can't be done on real computers, why bother trying to do
it on your desktop?  Surely you have more useful things to do.  If you ARE
a traveling saleman, you're gonna go broke waiting for the computer to
give you an optimal solution, just connect the dots on the map and go sell
something, like traveling salesmen have been doing for hundreds of years.

Michael Packard

new topic     » goto parent     » topic index » view message » categorize

11. Re: More printf problems 2

>it on your desktop?  Surely you have more useful things to do.  If you ARE
>a traveling saleman, you're gonna go broke waiting for the computer to
>give you an optimal solution,

        We can always play games while waiting for an answer? :)

Arthur P. Adamson, The Cincinnati Engine Man, euclid at isoc.net

new topic     » goto parent     » topic index » view message » categorize

12. Re: More printf problems 2

Ralf says:
>    There are so many different combinations to check and value in a
>short time. We need to learn that computer to see patterns and to check
>very very very deep in a short time, using a good-solution instead of
>perfect-solution-system.

        I recently read that the world record for a perfect answer, found
after immense effort has been raised to ~3200 cities. My progs do a good
approximation for 500. Jan's are better and faster.

        In the same vein, in answer to Matt's item-sum question, I have just
completed a prog which will:

1.      Given a pile of boxes of varying weights (random variation).
2.      Given a fleet of trucks of given carrying capacity (all the same).
3.      Sort the boxes into truck-loads with the weight approaching but not
exceeding the truck capacity.

        It runs fast (a few seconds for 500 boxes, 6 trucks) and finds
"good" answers in the Ralf sense.

        Let me know if you are interested (Matt, your copy is on the way.)

Bye, Art



Arthur P. Adamson, The Cincinnati Engine Man, euclid at isoc.net

new topic     » goto parent     » topic index » view message » categorize

13. Re: More printf problems 2

On Wed, 12 Nov 1997, Arthur Adamson wrote:
>         In the same vein, in answer to Matt's item-sum question, I have just
> completed a prog which will:
>
> 1.      Given a pile of boxes of varying weights (random variation).
> 2.      Given a fleet of trucks of given carrying capacity (all the same).
> 3.      Sort the boxes into truck-loads with the weight approaching but not
> exceeding the truck capacity.
>
>         It runs fast (a few seconds for 500 boxes, 6 trucks) and finds
> "good" answers in the Ralf sense.

That I can see would be a useful program.  Of course, you'd need to have
the boxes varying sizes too to be totally useful.  You NEVER have the
right sized box for something. =)

Michael
We still need a boxing game.

new topic     » goto parent     » topic index » view message » categorize

14. Re: More printf problems 2

Arthur Adamson wrote:

>         In the same vein, in answer to Matt's item-sum question, I
> have just
> completed a prog which will:
>
> 1.      Given a pile of boxes of varying weights (random variation).
> 2.      Given a fleet of trucks of given carrying capacity (all the
> same).
> 3.      Sort the boxes into truck-loads with the weight approaching
> but not
> exceeding the truck capacity.

    Hey, there was this puzzle just like the one above, and you could
win money with the best answer, I did try, but i suppose somebody else
got a better solution.

>         Let me know if you are interested (Matt, your copy is on the
> way.)

    Sure, sounds interesting...

Ralf N.
nieuwen at xs4all.nl

new topic     » goto parent     » topic index » view message » categorize

15. Re: More printf problems 2

>> 1.      Given a pile of boxes of varying weights (random variation).
>> 2.      Given a fleet of trucks of given carrying capacity (all the same).
>> 3.      Sort the boxes into truck-loads with the weight approaching but not
>> exceeding the truck capacity.

>That I can see would be a useful program.  Of course, you'd need to have
>the boxes varying sizes too to be totally useful.  You NEVER have the
>right sized box for something. =)

        Extending it to limit it by cubuc content would be easy but don't
ask me to choose the best length, width, and height to let the truck be
filled with no empth crevices :)
Bye, Art
Arthur P. Adamson, The Cincinnati Engine Man, euclid at isoc.net

new topic     » goto parent     » topic index » view message » categorize

16. Re: More printf problems 2

At 02:54 PM 11/12/97 -0800, you wrote:
>But if you AREN'T a traveling salesman, why would you waste your time
>trying to find an optimal solution to a problem you will never face?  And
>if as you say it can't be done on real computers, why bother trying to do
>it on your desktop?  Surely you have more useful things to do.  If you ARE
>a traveling saleman, you're gonna go broke waiting for the computer to
>give you an optimal solution, just connect the dots on the map and go sell
>something, like traveling salesmen have been doing for hundreds of years.
>
Oh, come on.  Don't you ever do anything, like work crossword puzzles, read
murder mysteries, watch hammy drammies on TV, just because you enjoy doing
them?  Does everything have to have a practical purpose?  Bah, humbug!

Wally Riley
wryly at mindspring.com

new topic     » goto parent     » topic index » view message » categorize

17. Re: More printf problems 2

At 12:02 AM 11/13/97 -0800, you wrote:
>We still need a boxing game.

Here it is:
BIFF!  ZOK!  POW!  (Flump!)
10 - 9 - 8 - 7 - 6 - 5 - 4 - 3 - 2 - 1 -
And the winnah is ---

Wally Riley
wryly at mindspring.com
>

new topic     » goto parent     » topic index » view message » categorize

18. Re: More printf problems 2

On Thu, 13 Nov 1997, Wallace B. Riley wrote:
> Oh, come on.  Don't you ever do anything, like work crossword puzzles, read
> murder mysteries, watch hammy drammies on TV, just because you enjoy doing
> them?  Does everything have to have a practical purpose?  Bah, humbug!

I don't waste days of my life doing something that in the final analysis
are counterproductive.  Why work on a problem you know you can't solve,
and even if you got the solution you couldn't use it practically in your
life?  If you want to waste your life, I guess you can, but I'd rather you
do something productive, like write a boxing game. =)

ok,ok I wrote a program once that computed Pi to an arbitrary number of
decimal places when I knew darn well only the first 4 are useful for any
normal application on earth, but I was young and didn't know better.

Michael Packard

new topic     » goto parent     » topic index » view message » categorize

19. Re: More printf problems 2

On Thu, 13 Nov 1997, Wallace B. Riley wrote:

> At 12:02 AM 11/13/97 -0800, you wrote:
> >We still need a boxing game.
>
> Here it is:
> BIFF!  ZOK!  POW!  (Flump!)
> 10 - 9 - 8 - 7 - 6 - 5 - 4 - 3 - 2 - 1 -
> And the winnah is ---
Mean Mikey!  (and the crowd goes wild)

I've wasted most of the last week playing 4d boxing.
Michael

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu