Print

Print


As for mean happiness, all it takes is a method in HeatBugs

public double getMeanHappiness(){
//go voer all bugs and compute the avg
}

then HeatbugsWithUI will have this new metric in the model tab. Presso n
the magnifying glass button near it, and you're in business.

If you don't want to change HeatBugs, extend it:
public class MyHeatBugs extends Heatbugs
{
//offer the constructors Heatbugs was offering
//add public double getMeanHappiness()
//(assuming you hav access to HeatBug[] bugs, which is package protected
//so you should have MyHeatBugs in sim.app.heatbugs )
}

You also need a different main() function

    public static void main(String[] args)
        {
        HeatBugsWithUI heatbugs = new HeatBugsWithUI(new
MyHeatBugs(System.currentTimeMillis()));
        Console c = new Console(heatbugs);
        c.setVisible(true);
        }

Of course, this would be enough if our bugs had anything to
resemble [un]happiness. So before you can have a happiness graph, you
kinda need to define/implement it at the bug level.

Gabriel


On Fri, 25 Aug 2006, MASON-INTEREST-L automatic digest system wrote:

> There are 2 messages totalling 76 lines in this issue.
>
> Topics of the day:
>
>   1. Heatbugs Graphs (2)
>
> ----------------------------------------------------------------------
>
> Date:    Thu, 24 Aug 2006 09:11:57 +0200
> From:    Alessandro Perrone <[log in to unmask]>
> Subject: Heatbugs Graphs
>
> hi all
>   It's a couple of weeks I am using Mason on my Mac to learn to use it.
> I have the sensation that with Mason it is impossible to create
> graphs at the starting of simulation.
> For example, the original heatbugs model written in Swarm contains a
> plot of "unhappines" of the mean of all unhappinesses values of
> heatbugs.
> In Mason implementation there's not such graph, but it is possible to
> plot the happiness of one heatbug.
> Is that true or not?
> All examples are of models in which there are a raster with various
> agents in it.  I have not found a model of only graphs.
> Regards.
> 					ALEX
>