Version française
Home     About     Download     Resources     Contact us    
Browse thread
AGI research using ocaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Eray Ozkural <examachine@g...>
Subject: Re: [Caml-list] AGI research using ocaml
Yes, but this would incur generation overhead. A lot of it if you
consider that I generate on the order of millions of tiny programs.
Not sure if it's a good idea. Any chance I can get a precise timer
interrupt to work gracefully?

The other option seems to be to hack meta ocaml so that I can get the
kind of timer exception I need.

Cheers,

On Sat, Mar 13, 2010 at 6:00 PM, blue storm <bluestorm.dylc@gmail.com> wrote:
> If you control the code, the easiest way is to :
> - add runtime profiling functions directly inside the generated code (for
> example, one before each function call and sequencing construct)
> - hardcode into your profiling functions the fact that, after a certain
> number of steps, excecution should be aborted.
>
> Example :
>
>   let count = ref 0
>   let max_count = 100 (* you choose that constant during generation *)
>   exception Terminated
>   let step () =
>     incr count;
>     if !count > max_count then raise Terminated
>
>   (* generated code *)
>   let code () =
>     ... ; step (); ...; step () ; ...
>
> You could probably also have max_count passed as a parameter at execution
> time (allowing you to execute the same generated code with different time
> limits).
>



-- 
Eray Ozkural, PhD candidate.  Comp. Sci. Dept., Bilkent University, Ankara
http://groups.yahoo.com/group/ai-philosophy
http://myspace.com/arizanesil http://myspace.com/malfunct