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 17:16:07 -0400

Sorry, reading this again, I think I should clarify my last response. The 
_concept_ is completely general; however, the implementation is a figment of my 
imagination. The code cited was just an implementation designed for 
one-dimensional equations that presents the idea; as discussed in earlier 
posts, it should be quite straightforward to generalize to any form, by taking 
an arbitrarty-size set of coefficients as a parameter to the solveFor method, 
for example. I think Paul alluded to this earlier in a somewhat different 
context.

-Miles

>>> Jayshree Sarma <address@hidden> 08/21 12:54 PM >>>
Miles,

Thanks for your code.  I have yet to learn Java 
but your code reads just like obj-c code.
Is your Function class code for a particular
form of equation or it is more general that?

The client wants to be able to try different 
equations for the consumer and producers and study
the simulation results.  The equation form is not
know before hand, it may be linear or non linear.
They want to be able to have swarm read in the eqaation
before the start of the simulation and use those
for the current simulation run.  

Jayshree

On Fri, 21 Aug 1998, Miles Parker wrote:

> 
> 
> 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.
                  =================================


                  =================================   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]