Package cu.repsystestbed.entities

Examples of cu.repsystestbed.entities.Group$TargetGpStrAssignment


      /*
       * @relation group
       * @attribute groupdId NUMERIC
       * @attribute numberAgents NUMERIC
       */
      Group g = new Group(groupInstance[0].intValue(), groupInstance[1].intValue());
      groups.add(g);
    }
   
    //parse and create group-strategy assignments
    source = new DataSource(strGrpFileName);
    instances = source.getDataSet();
    enu = instances.enumerateInstances();
    while(enu.hasMoreElements())
    {
      Instance temp = (Instance)enu.nextElement();
      logger.info("Parsing " + temp);
      if(temp.numValues()!=3) throw new Exception("Group-Strategy assignment line does not have 3 elements. This is illegal.");
      Double[] strGrpInstance = new Double[3];
      for(int i=0;i<temp.numValues();i++)
      {
        //number of values == 3
        strGrpInstance[i] = temp.value(i);
        if(strGrpInstance[i]==null) throw new Exception("A parameter in group-strategy line is null.");
      }
      /*
       * @attribute groupId NUMERIC
       * @attribute targetGroupId NUMERIC
       * @attribute strategyId NUMERIC
       */
      System.out.println("g1: " + strGrpInstance[0].intValue());
      System.out.println("g2: " + strGrpInstance[1].intValue());
      Group g1 = getGroup(strGrpInstance[0].intValue(), groups);
      if(g1==null) throw new Exception("Group not found in the parsed groups.");
      Group g2 = getGroup(strGrpInstance[1].intValue(), groups);
      if(g2==null) throw new Exception("Group not found in the parsed groups.");
      Strategy s = getStrategy(strGrpInstance[2].intValue(), strategies);
      if(s==null) throw new Exception("Strategy not found in the parsed strategies.");
      g1.assignTargetGpStrategy(g2, s);
    }
   
    //we have all the groups and the strategies associated with them. Now generate the feedbacks
    //create the agents first
    for(Group g : groups)
    {
      for(int i=0;i<g.getMaxNumOfAgents();i++) g.joinGroup(new Agent());
    }
    //create the feedbacks based on the strategies
    for(Group sourceGroup : groups)
    {
      for(TargetGpStrAssignment assignment : sourceGroup.getTargetGpStrategyAssignments())
      {
        Group targetGroup = assignment.m_targetGroup;
        ArrayList<Agent> sourceGroupMembers = sourceGroup.getMembers();
        ArrayList<Agent> targetGroupMembers = targetGroup.getMembers();
        for (Agent a : sourceGroupMembers)
        {
          for(Agent b : targetGroupMembers)
          {
            for(int i=0;i<assignment.m_strategy.getNumberOfFeedbacks();i++)
View Full Code Here

TOP

Related Classes of cu.repsystestbed.entities.Group$TargetGpStrAssignment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.