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:
1.1 KB
|
Line | |
---|
1 | package com.heuristiclab.problems.externalevaluation.test;
|
---|
2 |
|
---|
3 | import java.io.IOException;
|
---|
4 | import java.util.*;
|
---|
5 | import com.heuristiclab.problems.externalevaluation.*;
|
---|
6 | import com.heuristiclab.problems.externalevaluation.ExternalEvaluationMessages.*;
|
---|
7 |
|
---|
8 | public class RandomSocketPollEvaluator {
|
---|
9 |
|
---|
10 | public static void main(String[] args) {
|
---|
11 | ServerSocketListenerFactory factory = new ServerSocketListenerFactory(8842);
|
---|
12 | PollService service = new PollService(factory, 1);
|
---|
13 | service.start();
|
---|
14 | System.out.println("service started");
|
---|
15 |
|
---|
16 | Random random = new Random();
|
---|
17 | while (true) {
|
---|
18 | SolutionMessage msg = service.getSolution();
|
---|
19 | double quality = 0;
|
---|
20 | double[] qualities = new double[3];
|
---|
21 |
|
---|
22 | // single-objective
|
---|
23 | quality = random.nextDouble();
|
---|
24 | // multi-objective
|
---|
25 | //for (int i = 0; i < qualities.length; i++)
|
---|
26 | // qualities[i] = random.nextDouble();
|
---|
27 |
|
---|
28 | try {
|
---|
29 | // single-objective
|
---|
30 | service.sendQuality(msg, quality);
|
---|
31 | // multi-objective
|
---|
32 | //service.sendQualities(msg, qualities);
|
---|
33 | System.out.println("Quality sended");
|
---|
34 | } catch (IOException e) {
|
---|
35 | e.printStackTrace();
|
---|
36 | }
|
---|
37 | }
|
---|
38 | }
|
---|
39 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.