terça-feira, 14 de outubro de 2014

Stupidmodel

I have been using the Stupidmodel (https://code.google.com/p/repast-demos/wiki/StupidModel) to learning how to create a Repast model.


I already found two problems, one which I didn't solve yet. Other I found the solution in the Internet. Rembering all, I'm using Repast S, the 2.2 version and the Stupidmodel was implemented using the version 2.0.

The two problems:

  • GetLabel() in the DefaultStyleOGL2D.

The suggestion made to add a visible label to each Bug agent doesn't work. I read that there was a 'bug' related to this problem. But I only found a correction made for the 2.1 version, which I tried in the version I use, the 2.2., and it didn't work. Although I've added the following method to the BugStyleOGL2D class, I never got as output the value of the label (even if it is just "bla bla");
@Override
public String getLabel(final Object agent) {
//System.out.print(bug.getSize());
if (agent instanceof Bug){
final Bug bug = (Bug) agent;
  // System.out.println(label); 
    return new String("bla bla"); 
}
return super.getLabel(agent);

}

  • Adding a value layer, to get the cells in the environment, each one an agent, and each one with an attribute. 
The problem is described in http://sourceforge.net/p/repast/mailman/message/29342013/. 

The window in the 'options editor' doesn't show the Value editor as it should. I fixed it modifying the xml file repast.simphony.action.display_1.xml, removing 

<valueLayers/>

and adding the following lines:

   <valueLayers>
     <string>foodValueLayer</string>
  </valueLayers>


Sem comentários:

Enviar um comentário