VB.NET Tutorial 5: Computing Value of Information

From DSL

Jump to: navigation, search

It is easy to compute value of information with jSMILE. In our example, let us say that we want to compute how much we should pay our expert for his forecast about the market evolution.

We start with loading the network.

  Dim net As new Network()
  net.ReadFile("tutorial_b.xdsl")

The class ValueOfInfo is provided to allow easy specification of the nodes we are interested in. Let us declare an instance of this class and link it to the current network. The class will perform some checking internally to make sure the query makes sense.

  Dim voi As new ValueOfInfo(net)

We want to know what is the value of information of the node Forecast with respect of the node Invest. In other words, we want to know how valuable it is for us to know the value of the node Forecast before we make our decision. For this calculation we will need to fill this data into the ValueOfInfo class.

  net.GetNode("Forecast")
  net.GetNode("Invest")

We will use the AddNode() method to specify all the nodes we want to compute the value of information of. You can add as many as you want by calling this method once for each node. However, it is important to note, that if several nodes are specified, the value of information computed will be the value of knowing all the nodes at the same time. If you want to know the value of information of individual nodes, you will have to repeat the procedure shown in this tutorial once for each node.

  voi.AddNode("Forecast")

Since we want to know the value of knowing Forecast before we decide about Invest, we will use the SetDecision() method to establish Invest as the decision node.

  voi.SetDecision("Invest")

Now we compute the value of information by calling Update() method.

  voi.Update()

The results will have a similar structure to that of the value of a value node that was shown in the Tutorial 4. Our example is an easy case because we only have one decision in the model so we will only have one number as a result.

  Dim results() As Double = voi.GetValues()
  Dim EVIForecast As double = results(0)

The only thing left is to print the retrieved value.

  Console.WriteLine("Expected Value of Information (""Forecast"") = " + EVIForecast.ToString())

In general, we can have several decision nodes. In that case, the value of information of a node C (from Chance) with respect to a node D (from Decision) will be indexed by all the temporal predecessors of that decision D. A temporal predecessor is a decision node that precedes the node D in time and also all the informational predecessors of those decision nodes and the node D. If that would be the case, we would have to use the GetIndexingNodes() method to get the handles of the temporal predecessors.

Personal tools