swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Handling equations as objects


From: Miles Parker
Subject: Re: Handling equations as objects
Date: Fri, 21 Aug 1998 12:09:20 -0400


Miles T. Parker                 mailto:address@hidden 
Research Software Engineer                              202.797.6136
The Brookings Institution                     fax 202.797.6319
1775 Massachusettes Avenue, N.W., Washington, D.C. 20036


>>> Jayshree Sarma <address@hidden> 08/21 11:10 AM >>>
Yes, the functional form of the equation can change.  Also
the number of terms in the equation can increase/decrease. The
values of the parameters/coefficients can also change.

In this case, using my code for context (sorry I'm speaking a different 
language!), you simply create various subclasses for each functional form, and 
then instantiate them and assign them to agents or collections of agents as 
appropriate. It might even be useful to create ready instatiations of these (or 
even a factory class or method) so that you could simply set the appropriate 
function for a given agent, but you wouldn't have to instantiate for each 
agent, e.g.:

*****

public class MyAgent {

    private Function function;

    public static final FUNCTION_FORM_1 = new FunctionForm1();

    public static final FUNCTION_FORM_2 = new FunctionForm2();

   public void setFunction(Function function) {
       this.function = function;
   }
}

*****

myAgent.setFunction(Agent.FUNCTION_FORM_1);

Of course, you would have to change the example significantly to support 
changing numbers of parameters...you'd might provide setters for everything 
(perhaps with some mechanism for distinguishing parameters from terms) and some 
no parameter solve method, OR...better, you might just create a "ParamaterSet" 
class that would support n dimensions.

-Miles


                  =================================   Swarm-Support is for 
discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.
                  ================================

reply via email to

[Prev in Thread] Current Thread [Next in Thread]