Package cu.repsystestbed.data

Examples of cu.repsystestbed.data.Strategy


       * @attribute feedbackMean NUMERIC
       * @attribute feedbackStdDev NUMERIC
       */
     
      //TODO do checks to make sure feedbackMean and feedbackStdDev are in [0,1].
      Strategy s = new Strategy(strategyInstance[0].intValue(),
          strategyInstance[1].intValue(), strategyInstance[2], strategyInstance[3]);
     
      strategies.add(s);
    }
   
    //parse and create groups
    source = new DataSource(grpFileName);
    instances = source.getDataSet();
    enu = instances.enumerateInstances();
    while(enu.hasMoreElements())
    {
      Instance temp = (Instance)enu.nextElement();
      logger.info("Parsing " + temp);
      if(temp.numValues()!=2) throw new Exception("Group line does not have 2 elements. This is illegal.");
      Double[] groupInstance = new Double[2];
      for(int i=0;i<temp.numValues();i++)
      {
        //number of values == 2
        groupInstance[i] = temp.value(i);   
        if(groupInstance[i]==null) throw new Exception("A parameter in group line is null.");
      }
      /*
       * @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
View Full Code Here

TOP

Related Classes of cu.repsystestbed.data.Strategy

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.