{
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);
}