Author Topic: Help for aplication  (Read 14257 times)

Offline camus

  • Newbie
  • *
  • Posts: 8
    • View Profile
Help for aplication
« on: July 05, 2007, 00:31:40 »
Hi,


I will need building aplication using APIs in Visual C++ 6.0, somebody help me with examples that show me how start my project??

Thanks a lot.

Offline Martin

  • HUGIN Expert
  • Hero Member
  • *****
  • Posts: 613
    • View Profile
Re: Help for aplication
« Reply #1 on: July 11, 2007, 12:18:35 »
Hello

You should consult the Hugin API reference manual, Chapter 1.3 'Using the Hugin API on Windows platforms'. It has a description on how to setup Microsoft Visual Studio 6.0 for using the C++ Hugin API.

After setting up your programming environment, you should check out the the Hugin C++ API manual, as it contains code examples of how to use the Hugin C++ API, as well as a description of all the Hugin C++ classes.
Hugin Expert A/S

Offline camus

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Help for aplication
« Reply #2 on: July 24, 2007, 23:14:53 »
For example,

I configured my project for visual 6.0, but i'am need read information the bayesian web  created in Hugin, for example, golf.net. ¿can you help me with any example for do this?

In the manual i not find information for do this. Thanks a lot.

Offline Martin

  • HUGIN Expert
  • Hero Member
  • *****
  • Posts: 613
    • View Profile
Re: Help for aplication
« Reply #3 on: July 25, 2007, 11:09:06 »
I think what you are looking for is the 'Load and Propagate' example, which can be found in the C++ API manual - as well as other code examples of how to use the C++ API.

The API reference manual (C API Manual) gives a thorough description of the Hugin API functionality. To use the golf network you should look at the following functions:

- A network is loaded by constructing a Domain from a net file.
       h_net_parse_domain (C API) / Domain constructor (C++ and Java)
- The domain must be compiled before using it for inference.  This is done using
       h_domain_compile (C API) / Domain.compile (C++ and Java)
- Nodes can be retrieved:
       h_domain_get_first_node h_node_get_next (C API) / Domain.getNodes (C++ and Java)
- You typically insert evidence (for discrete nodes) using
       h_node_select_state (C API) / DiscreteNode.selectState (C++ and Java)
- The evidence must be propagated:
       h_domain_propagate (C API) / Domain.propagate (C++ and Java)
- After propagation, you retrieve updated beliefs using:
       h_node_get_belief (C API) / DiscreteChanceNode.getBelief (C++ and Java)
Hugin Expert A/S

Offline camus

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Help for aplication
« Reply #4 on: July 28, 2007, 00:44:55 »
Thnaks for your replies,

I probe some examples incluided in the C++ API manual, I can compile and load  bayesian red but need functions for introducing input data values  to my red. For example, i take values in the DB and this data is input for my red, what need for do this? 

Offline Martin

  • HUGIN Expert
  • Hero Member
  • *****
  • Posts: 613
    • View Profile
Re: Help for aplication
« Reply #5 on: August 02, 2007, 16:05:33 »
I am not exactly sure I understand your question.

Are you seeking to:
- Use data for inserting evidence and doing inference?
Entering evidence is covered in chapter 8 'Evidence and Beliefs' and inference is covered in chapter 9.(these chapters cover the functions mentioned in my previous response).

- Use data for updating probabilities?
Updating the conditional probability tables using data is covered in chapter 10, 'Sequential Updating of
Conditional Probability Tables'.
Hugin Expert A/S

Offline camus

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Help for aplication
« Reply #6 on: August 03, 2007, 02:29:58 »
I use a HAPI namespace, i need a function for introducing evidence.  In the API manual is:

- select node with: h_domain_get_node_by_name (h_kb_load_domain, "name")

and after:

h_node_select_state ("node", 0).

but i check in the C++ manual API for this function, but i don´t  find how do this.

Thanks.

Offline Martin

  • HUGIN Expert
  • Hero Member
  • *****
  • Posts: 613
    • View Profile
Re: Help for aplication
« Reply #7 on: August 03, 2007, 10:57:33 »
The C++ API classes and methods follow a naming convention, where the opaque pointer types in C corresponds to classes in C++. For example (C) h_node_t and (C++) class Node.

Naming convention:
The equivalent method in C++ can easily be found by 'dissecting' the name of the C function:
The first word after h_ often resembles the name of a class in C++, and the remaining part of the function often resembles the name of the method, eg.: h_myclass_name_of_method ~ Myclass::nameOfMethod.

For example, with the two C functions you have found:
C function: h_domain_get_node_by_name
First place to look in C++ API would be for the method:
Domain::getNodeByName
In the C++ API it has been natural to add some extra classes - so in fact Domain::getNodeByName is inherited from class NetworkModel.

C function: h_node_select_state
In the C++ API the class Node is the base class for all node types, and there are different sub-classes for each node type. h_node_select_state is a function that work on discrete nodes, so the C++ equivalent can be found in the Node sub-class DiscreteNode::selectState .

This way the name of the C function gives a hint about where too look when searching for the equivalent C++ functionallity.
(The manual does also touch the subject in 1.4 'Naming conventions')
Hugin Expert A/S