analog-garage / dimple

Dimple: Java and Matlab libraries for probabilistic inference
Apache License 2.0
80 stars 17 forks source link

Define input as an ILP? #11

Open danyaljj opened 8 years ago

danyaljj commented 8 years ago

A small question: can I use your library as ILP solver? in other words, can I use, say your BP, in order to solver an ILP?

analog-cbarber commented 8 years ago

In general, no.

BP will only give you an approximate answer if your graph is not singly connected. However, if your graph uses only discrete variables and is singly connected (or is small enough to be made singly connected using the JunctionTree algorithm) then you can solve some ILP problems using BP.

danyaljj commented 8 years ago

There is no question that the solution will be approximate. Let's say I have a well-defined problem with discrete values and singly connected graph. The main question I have is the format in which we define an input problem. Here is an example code I found for Dimple:

screen shot 2016-03-29 at 2 28 12 pm

Now the question is, let's say I have a problem in the following format:

screen shot 2016-03-29 at 2 29 36 pm

How would you go for coding such problem in Dimple? Is there any intermediate representation based on ILP in your system?

analog-cbarber commented 8 years ago

First, this is only going to work if you are working with a relatively small bounded subset of Z, as is the case with the parity check example.

There is no pre-canned code for converting the standard ILP formulation into a graphical model in dimple, but here is how I think you would go about it: