Hello,

In that case just look at the CMAE docs (the read me is inside "cmaes")
If this is too complicated, you may need to use SciLab for example
www.scilab.org


Best regards,
Tomasz Janeczko
amibroker.com
  ----- Original Message ----- 
  From: Dennis Brown 
  To: [email protected] 
  Sent: Monday, July 07, 2008 4:46 PM
  Subject: Re: [amibroker] Code help please... Optimize with CMAE


  Thank you both for continuing to provide help.


  I really do not need to solve an exhaustive search for two variables with a 
simplistic objective.  I really need to solve problems that have many variables 
and a very complex objective formula that is not suitable for an exhaustive 
search.


  I only provided this simplest of all cases so the the problem would not get 
in the way of my question of how to connect this simple case to the CMAE engine.


  If that is too complicated to address on this list, then I will have to look 
elsewhere for help.


  Again, thank you for your responses,


  Dennis


  On Jul 7, 2008, at 9:19 AM, Tomasz Janeczko wrote:


    Hello,

    Here is the simplest exhaustive search sample:

    function Objective( x, y ) 
    { 
      return sin(x) * cos(y); 
    } 

    xmin = 0; 
    xmax = 100; 
    xstep = 1; 
    xbest = Null; 
    ymin = 0; 
    ymax = 100; 
    ystep = 1; 
    ybest = Null; 


    best = -1e9; 

    for( x = xmin; x <= xmax; x += xstep ) 
    for( y = ymin; y <= ymax; y += ystep ) 
    { 
       f = Objective( x, y ); 

       if( f > best ) 
       { 
            best = f; 
            xbest = x; 
            ybest = y; 
       } 
    } 

    printf("Best f = %g, at x = %g, y = %g", best, xbest, ybest );

    Best regards,
    Tomasz Janeczko
    amibroker.com
      ----- Original Message -----
      From: Paul Ho
      To: [email protected]
      Sent: Monday, July 07, 2008 2:29 PM
      Subject: RE: [amibroker] Code help please... Optimize with CMAE


      I think using an exhaustive search would be a way to start.  since you 
only have 2 parameters, you can also put a little bit of smart in there 
yourself.
      for example, if X*Y == 100 or close to that. there can be a constraint in 
place to restrict the range of  Y searched for a particular value of X, and 
vice versa,
      Cheers
      Paul.



------------------------------------------------------------------------
        From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of 
Dennis Brown
        Sent: Monday, 7 July 2008 10:17 PM
        To: [email protected]
        Subject: Re: [amibroker] Code help please... Optimize with CMAE


        Tomasz and Paul,

        Thank you for responding.

        Yes, I also had looked at those sources, but being that I am able to 
        only stumble along with C++, it is Greek to me.

        I think I would be better off trying to understand how to modify the 
        AmiBroker plugin DLL to call back my AFL objective function.

        It is still Greek, but at least it is a simpler and meaningful Greek 
        phrase to start with.

        I would still welcome any specific advice or hints in areas that I am 
        likely to stumble over.

        Best regards,
        Dennis

        > On Jul 7, 2008, at 7:10 AM, Tomasz Janeczko wrote:
        >
        > Yes, these sources are actually included in what you already have on 
        > your hard disk
        > under ADK\CMAE\cmaes
        >
        > Best regards,
        > Tomasz Janeczko
        > amibroker.com
        >> ----- Original Message -----
        >> From: Paul Ho
        >> To: [email protected]
        >> Sent: Monday, July 07, 2008 12:22 PM
        >> Subject: RE: [amibroker] Code help please... Optimize with CMAE
        >>
        >> Go to the guy's site where Tomasz download his source code from, 
        >> download his source code, and stare at that one instead, I think 
        >> its a lot closer to what you want. 
http://www.bionik.tu-berlin.de/user/niko/cmaes_c.tar.gz

        >>
        >>
        >> On Jul 7, 2008, at 4:05 AM, Tomasz Janeczko wrote:
        >>
        >> Dennis,
        >>
        >> The optimizer plugin architecture uses backtester. You can't go 
        >> without using backtester.
        >> Call to pfEvaluateFunc invokes full-blown backtest for given 
        >> parameter set.
        >>
        >> If you would like to optimize "general purpose" functions without 
        >> using backtester,
        >> you would need to take sources provided and write your own plugin 
        >> that won't
        >> use backtesting engine at all.
        >>
        >> Best regards,
        >> Tomasz Janeczko
        >> amibroker.com
        >> ----- Original Message -----
        >> From: "Dennis Brown" <[EMAIL PROTECTED]>
        >> To: <[email protected]>
        >> Sent: Monday, July 07, 2008 3:30 AM
        >> Subject: [amibroker] Code help please... Optimize with CMAE
        >>
        >>
        >>> Hello,
        >>>
        >>> I have been staring at the CMAE DLL stuff for days and I really need
        >>> some help to figure out how to use it in a particular way.
        >>>
        >>> I would like to use the optimizer in a generic sense to do the
        >>> following from AFL without using the internal backtester, meaning 
        >>> only
        >>> AFL in indicator mode:
        >>>
        >>> Initialize 2 items:
        >>> item 1 is X and has a default,min,max,step,current,best values
        >>> 1,1,1000,1,1,1
        >>> item 2 is Y and has a default,min,max,step,current,best values
        >>> 1,1,1000,1,1,1
        >>>
        >>> The objective is to optimize X and Y so that X*Y==100
        >>>
        >>> objective function in AFL:
        >>> function Objective()
        >>> {
        >>> return 100 - X*Y;
        >>> }
        >>>
        >>> The steps I would need to take as I understand them are:
        >>>
        >>> 1. Initialize the X and Y OptimizeItems by calling
        >>> OptimizerInit( with bunch of arguments) --most arguments are
        >>> irrelevant to this test.
        >>>
        >>> 2. Start the optimizer engine by calling 
        >>> pfEvaluateFunc( pContext ) --
        >>> there really is no context that I understand for this test.
        >>>
        >>> 3. The DLL calls back for the objective AFL function
        >>>
        >>> 4. It runs step 3 a number of times to find the solution of X=Y=10
        >>>
        >>> 5. OptimizerFinalize(same bunch of arguments as step 1)
        >>>
        >>> Of course I would prefer that step 3 is AFL calling the optimizer 
        >>> DLL
        >>> instead (simple mode), but I did not think that is how the CMAE 
        >>> works.
        >>>
        >>> Anyway, if I could get this simple case to work, I am sure I could
        >>> figure out how do do much more complicated cases after that on my 
        >>> own.
        >>>
        >>> Of course if there is no way to use the existing DLL without 
        >>> changing
        >>> it, I would like to know that also. I should be able to make modest
        >>> changes to the DLL myself.
        >>>
        >>> Please any hints or AFL code is appreciated.
        >>>
        >>> Best regards,
        >>> Dennis
        >>>




   

Reply via email to