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
|
Rev | Line | |
---|
[15014] | 1 | package com.heuristiclab.problems.externalevaluation.test;
|
---|
| 2 |
|
---|
| 3 | import java.io.IOException;
|
---|
| 4 | import java.util.Random;
|
---|
| 5 | import com.heuristiclab.problems.externalevaluation.*;
|
---|
| 6 | import com.heuristiclab.problems.externalevaluation.ExternalEvaluationMessages.*;
|
---|
| 7 |
|
---|
| 8 | public 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.