Java Tutorial Code 5: Computing Value of Information
From DSL
(Redirected from Java Code: Tutorial 5: Computing Value of Information)
public void ComputeValueOfInformation() {
try {
Network net = new Network();
net.readFile("tutorial_b.xdsl");
ValueOfInfo voi = new ValueOfInfo(net);
// Getting the handles of nodes "Forecast" and "Invest":
net.getNode("Forecast");
net.getNode("Invest");
voi.addNode("Forecast");
voi.setDecision("Invest");
voi.update();
double[] results = voi.getValues();
double EVIForecast = results[0];
System.out.println("Expected Value of Information (\"Forecast\") = " + EVIForecast);
}
catch (SMILEException e) {
System.out.println(e.getMessage());
}
}