I am trying to implement an integer solver using Ojalgo across time series data, with only first-order constraints and a linear first-order objective function. All my variables are integers. I am instantiating the model with:
ExpressionsBasedModel model = new ExpressionsBasedModel();
for(DataObject obj : myData){
Variable var = model.createVariable(obj.identifierString).integer(true).lower(0).weight(obj.cost);
}
//Then expressions are sort of tree-like
for(DataObjectContainer cont : myContainers){
Expression expr = model.addExpression(cont.id).lower(cont.lower).upper(cont.upper);
expr.setLinearFactors(cont.dataObjectList, cont.dataObjectLoadList);
}
Then I was trying model.minimise(), but the result I got out of that just evenly distributed variable didn't actually solve it. I wasn't sure how to access the results either. I was pulling model variables from model.getVariables(), and then just read those with var.getIntValue(). I also tried getting the result values by index, like result.get(i).
What is the canonical way to access results, and is model.minimise() sufficient to solve the integer model?
My data is pretty simple, but there is a lot of it. There are two types of containers that do not overlap between the same types, but two different types of containers might share some variables in their expressions.
I was trying to get an integer value that minimized a linear objective function.