-
Notifications
You must be signed in to change notification settings - Fork 33
Description
I am trying to integrate keanu with an agent-based model that uses the MASON toolkit, but having trouble with building the UnaryOpLambda to run the model and the arguments it needs.
The current state of my model (state) can be represented by a vector of all the agents' x and y locations and their max speed ([x0,y0,s0,x1,y1,s1,...,]). We represent this as a ConstantDoubleVertex[].
The UnaryOpLambda should take the current state and call a predict function, which itself takes a state and returns a new state after iterating the model. predict is defined like:
public static ConstantDoubleVertex[] predict(ConstantDoubleVertex[] state) {
// take 'state' and run the model forward x iterations
return state
}
Here is the problem:
UnaryOpLambda<ConstantDoubleVertex[], ConstantDoubleVertex[]> box =
new UnaryOpLambda<ConstantDoubleVertex[], ConstantDoubleVertex[]>(
new long[]{state.length}, state, StationTransition::predict);
Which returns the error:
Error:(153, 113) java: incompatible types: io.improbable.keanu.vertices.dbl.nonprobabilistic.ConstantDoubleVertex[] cannot be converted to io.improbable.keanu.vertices.Vertex<io.improbable.keanu.vertices.dbl.nonprobabilistic.ConstantDoubleVertex[]>
The problem as I understand it is that UnaryOpLambda accepts only a single vertex as its argument. How can I pass an array as the input to UnaryOpLambda? Or is there a better way of doing this?