Package cu.repsystestbed.graphs

Examples of cu.repsystestbed.graphs.FeedbackHistoryGraph


  private void createWorkflow() throws Exception
  {
    BasicConfigurator.configure();
   
    // create the graphs
    FeedbackHistoryGraph feedbackHistoryGraph = new FeedbackHistoryGraph(new FeedbackHistoryEdgeFactory());
    ReputationGraph repGraph = new ReputationGraph(new ReputationEdgeFactory());
    TrustGraph trustGraph = new TrustGraph(new TrustEdgeFactory());
   
    // populate the feedback history graph by parsing the feedbacks from a arff file
    DefaultArffFeedbackGenerator feedbackGen = new DefaultArffFeedbackGenerator();
    List<Feedback> feedbacks = feedbackGen.generateHardcoded("feedbacks.arff");
   
    // add the feedbacks to the feedback history graph
    for(Feedback f : feedbacks)
    {
      feedbackHistoryGraph.addFeedback(f);
    }
   
    // create the algorithms
    EigenTrust repAlg = (EigenTrust) ReputationAlgorithm.getInstance("cu.repsystestbed.algorithms.examples.EigenTrust");
    RankbasedTrustAlg trustAlg = (RankbasedTrustAlg) TrustAlgorithm.getInstance("cu.repsystestbed.algorithms.examples.RankbasedTrustAlg");
View Full Code Here


    /**
     * Creates a feedback graph
     * @param graphConfig This object contains all of the configurations for this graph
     */
    public SimFeedbackGraph(GraphConfig graphConfig) {
        super(graphConfig, (SimpleDirectedGraph) new FeedbackHistoryGraph(new FeedbackHistoryEdgeFactory()));
    }
View Full Code Here

  public static void main(String[] args) throws Exception
  {
    BasicConfigurator.configure();
   
    // create the graphs
    FeedbackHistoryGraph feedbackHistoryGraph = new FeedbackHistoryGraph(new FeedbackHistoryEdgeFactory());
    ReputationGraph repGraph = new ReputationGraph(new ReputationEdgeFactory());
    TrustGraph trustGraph = new TrustGraph(new TrustEdgeFactory());
   
    // populate the feedback history graph by parsing the feedbacks from a arff file
    DefaultArffFeedbackGenerator feedbackGen = new DefaultArffFeedbackGenerator();
    ArrayList<Feedback> feedbacks = (ArrayList<Feedback>) feedbackGen.generateHardcoded("feedbacks.arff");
   
    // add the feedbacks to the feedback history graph
    feedbackHistoryGraph.addFeedbacks(feedbacks, true);
   
    // create the algorithms
    EigenTrust repAlg = (EigenTrust) ReputationAlgorithm.getInstance("cu.repsystestbed.algorithms.examples.EigenTrust");
    RankbasedTrustAlg trustAlg = (RankbasedTrustAlg) TrustAlgorithm.getInstance("cu.repsystestbed.algorithms.examples.RankbasedTrustAlg");
   
View Full Code Here

  {
   
    BasicConfigurator.configure();
   
    //create graphs
    FeedbackHistoryGraph feedbackHistoryGraph = new FeedbackHistoryGraph(new FeedbackHistoryEdgeFactory());
    ReputationGraph repGraph = new ReputationGraph(new ReputationEdgeFactory());
    TrustGraph trustGraph = new TrustGraph(new TrustEdgeFactory());
   
    //swing listeners
    Workflow2 workflow2 = new Workflow2(feedbackHistoryGraph, repGraph, trustGraph);
    workflow2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    workflow2.setSize(400, 320);
    workflow2.setVisible(true);
   
    //eigentrust needs to use the feedback history graph
    EigenTrust repAlg = (EigenTrust) ReputationAlgorithm.getInstance("cu.repsystestbed.algorithms.examples.EigenTrust");
    repAlg.setGraph2Listen(feedbackHistoryGraph);
    repAlg.setGraph2Output(repGraph);
   
    //add eigentrust as an observer to the feedback history graph
    feedbackHistoryGraph.addObserver(repAlg);
   
    //rank based trust alg needs to use the reputation graph
    RankbasedTrustAlg trustAlg = (RankbasedTrustAlg) TrustAlgorithm.getInstance("cu.repsystestbed.algorithms.examples.RankbasedTrustAlg");
    trustAlg.setRatio(0.7);
    //must be called in this sequence otherwise setReputationGraph() will create a new trust graph
    trustAlg.setGraph2Output(trustGraph);
    trustAlg.setGraph2Listen(repGraph);

   
    //add rank based trust alg as an observer to the reputation graph
    repGraph.addObserver(trustAlg);
   
    //parse the feedbacks from the arff file
    DefaultArffFeedbackGenerator feedbackGen = new DefaultArffFeedbackGenerator();
    ArrayList<Feedback> feedbacks = (ArrayList<Feedback>) feedbackGen.generateHardcoded("feedbacks.arff");
   
    //add the feedbacks to the feedback history graph
    feedbackHistoryGraph.addFeedbacks(feedbacks, true)
    feedbackHistoryGraph.notifyObservers(true);

  }
View Full Code Here

        m_graph2Output.addEdge(src, sink);
      }
    }
    else
    {
      FeedbackHistoryGraph feedbackHistoryGraphTransitive = ((FeedbackHistoryGraph)this.m_graph2Listen).getTransitiveClosureGraph();
      Set<FeedbackHistoryGraphEdge> edges = feedbackHistoryGraphTransitive.edgeSet();
      for(FeedbackHistoryGraphEdge edge : edges)
      {
        Agent src = (Agent)edge.src;
        Agent sink = (Agent)edge.sink;
        m_graph2Output.addVertex(src);
View Full Code Here

    //initialize the eigentrust parameters
//    repAlg.setIterations(10);
//    repAlg.setThreshold2Satisfy(0.7);
   
    //create a feedback history graph
    FeedbackHistoryGraph feedbackHistoryGraph = new FeedbackHistoryGraph(new FeedbackHistoryEdgeFactory());
   
    //parse the feedbacks from the arff file
    DefaultArffFeedbackGenerator feedbackGen = new DefaultArffFeedbackGenerator();
    List<Feedback> feedbacks = feedbackGen.generateHardcoded("feedbacks.arff");
   
    //add the feedbacks to the feedback history graph
    for(Feedback f : feedbacks)
    {
      feedbackHistoryGraph.addFeedback(f);
    }
   
    //eigentrust needs to use the feedback history graph
    repAlg.setGraph2Listen(feedbackHistoryGraph);
   
    //add eigentrust as an observer to the feedback history graph
    feedbackHistoryGraph.addObserver(repAlg);
   
    //make eigentrust calculate the reputation of all the agents
    feedbackHistoryGraph.notifyObservers(false);
   
    ReputationGraph repGraph = (ReputationGraph) repAlg.getGraph2Output();
    //TODO display the reputation graph.
   
    RankbasedTrustAlg trustAlg = (RankbasedTrustAlg) TrustAlgorithm.getInstance("cu.repsystestbed.algorithms.RankbasedTrustAlg");
View Full Code Here

       
        if(t_graphType.toLowerCase().equals("fhg"))
        {
          DefaultArffFeedbackGenerator gen = new DefaultArffFeedbackGenerator();
          ArrayList<Feedback> feedbacks = (ArrayList<Feedback>) gen.generateHardcoded(t_graphInputFile);
          FeedbackHistoryGraph fhg = new FeedbackHistoryGraph(new FeedbackHistoryEdgeFactory());
          fhg.addFeedbacks(feedbacks, false);
          m_storage.put(t_graphName, fhg);
        }
        else if(t_graphType.toLowerCase().equals("rg"))
        {
          ReputationGraphCreator gen = new ReputationGraphCreator();
View Full Code Here

        if(i > 0 && !(m_workflow.sequence.get(i-1) instanceof Graph))
        {
          switch(((Algorithm) o).getInputGraphType())
          {
          case FHG:
            FeedbackHistoryGraph fhg = new FeedbackHistoryGraph(new FeedbackHistoryEdgeFactory());
            m_workflow.addItem(fhg);
            storage.put("int_fhg_" + r.nextInt(1000), fhg);
            break;
          case RG:
            ReputationGraph rg = new ReputationGraph(new ReputationEdgeFactory());
View Full Code Here

  public static void main(String[] args) throws Exception
  {
    BasicConfigurator.configure();
   
    Hashtable<String, Object> storage = new Hashtable<String, Object>();
    storage.put("fhg", new FeedbackHistoryGraph(new FeedbackHistoryEdgeFactory()));
    storage.put("et", new EigenTrust());
    storage.put("rg", new ReputationGraph(new ReputationEdgeFactory()));
    storage.put("as", new Appleseed());
    storage.put("rk", new RankbasedTrustAlg());
    storage.put("tg", new TrustGraph(new TrustEdgeFactory()));
View Full Code Here

         
          try
          {
           
            feedbacks = (ArrayList<Feedback>) feedbackGen.generateHardcoded(graphInputFile);
            FeedbackHistoryGraph feedbackHistoryGraph = (FeedbackHistoryGraph) createGraphInstance(FEEDBACKHISTORYGRAPH);
            Util.assertNotNull(feedbackHistoryGraph);
            feedbackHistoryGraph.addFeedbacks(feedbacks, false);
            m_workflow.addItem(feedbackHistoryGraph);
           
          }
          catch(Exception e)
          {
View Full Code Here

TOP

Related Classes of cu.repsystestbed.graphs.FeedbackHistoryGraph

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.