-
Notifications
You must be signed in to change notification settings - Fork 0
/
SubmissionTemplate.java
49 lines (39 loc) · 1.25 KB
/
SubmissionTemplate.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import org.vu.contest.ContestSubmission;
import org.vu.contest.ContestEvaluation;
import java.util.Random;
import java.util.Properties;
public class SubmissionExample implements ContestSubmission
{
Random rnd_;
ContestEvaluation evaluation_;
public SubmissionTemplate()
{
rnd_ = new Random();
}
public void setSeed(long seed)
{
// Set seed of algortihms random process
rnd_.setSeed(seed);
}
public void setEvaluation(ContestEvaluation evaluation)
{
// Set evaluation problem used in the run
evaluation_ = evaluation;
// Get evaluation properties
Properties props = evaluation.getProperties();
// Property keys depend on specific evaluation
// E.g. double param = Double.parseDouble(props.getProperty("property_name"));
// Do sth with property values, e.g. specify relevant settings of your algorithm
}
public void run()
{
// Run your algorithm here
// Getting data from evaluation problem (depends on the specific evaluation implementation)
// E.g. getting a vector of numbers
// Vector<Double> data = (Vector<Doulbe>)evaluation_.getData("trainingset1");
// Evaluating your results
// E.g. evaluating a series of true/false predictions
// boolean pred[] = ...
// Double score = (Double)evaluation_.evaluate(pred);
}
}