Free cookie consent management tool by TermsFeed Policy Generator

Changes between Version 6 and Version 7 of Documentation/Howto/OptimizeExternalApplications


Ignore:
Timestamp:
06/04/10 16:20:03 (14 years ago)
Author:
abeham
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Documentation/Howto/OptimizeExternalApplications

    v6 v7  
    5353[[Image(ExternalEvaluationServiceTestCD.png)]]
    5454
     55Here is the java code for the main method of the `RandomStreamingPollEvaluator`
     56
     57{{{#!java
     58public static void main(String[] args) {
     59        StreamChannelFactory factory = new StreamChannelFactory(System.in, System.out);
     60        PollService service = new PollService(factory, 1);
     61        service.start();
     62       
     63        Random random = new Random();
     64        while (true) {
     65                SolutionMessage msg = service.getSolution();
     66                // parse the message and retrieve the variables there
     67                try {
     68                        service.sendQuality(msg, random.nextDouble());
     69                } catch (IOException e) {
     70                        break;
     71                }
     72        }
     73       
     74        service.stop();
     75}
     76}}}
     77
     78This code shows a concrete example of how to use the !PollService and the ease of integrating this into an external java application.
     79
    5580=== Preparing an `ExternalEvaluationProblem` ===
    5681