Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/tools/ExternalEvaluation/Java/RegularExternalApplication/src/com/heuristiclab/problems/externalevaluation/test/RandomStreamingPollEvaluator.java @ 15014

Last change on this file since 15014 was 15014, checked in by pfleck, 7 years ago

Added code and tools for the ExternalEvaluationProblem. (e.g. Java-side evaluation)

File size: 814 bytes
Line 
1package com.heuristiclab.problems.externalevaluation.test;
2
3import java.io.IOException;
4import java.util.Random;
5import com.heuristiclab.problems.externalevaluation.*;
6import com.heuristiclab.problems.externalevaluation.ExternalEvaluationMessages.*;
7
8public class RandomStreamingPollEvaluator {
9
10  public static void main(String[] args) {
11    StreamListenerFactory factory = new StreamListenerFactory(System.in, System.out);
12    PollService service = new PollService(factory, 1);
13    service.start();
14   
15    Random random = new Random();
16    while (true) {
17      SolutionMessage msg = service.getSolution();
18      // parse the message and retrieve the variables there
19      try {
20        service.sendQuality(msg, random.nextDouble());
21      } catch (IOException e) {
22        break;
23      }
24    }
25   
26    service.stop();
27  }
28}
Note: See TracBrowser for help on using the repository browser.