I am trying to reproduce the result of the fzero's MATLAB function in JAVA. After searching around, I found the library JOM(Java Optimization Modeler). I wrote a very simple program in order to test its efficiency and I am not able to find the correct value, I am using a very simple evaluation function : x - 100 with the objective to minimize it. I would like to know if my code is wrong or if you could suggest me another library doing better ? The below code found the optimal solution to be 0.0, I was expecting 100.
/* Create the optimization problem object */
OptimizationProblem op = new OptimizationProblem();
op.addDecisionVariable("x", false, new int[] { 1 , 1 }, 0 , Double.MAX_VALUE);
/* Sets the objective function */
op.setObjectiveFunction("minimize", "x-100");
op.solve("ipopt");
if (!op.solutionIsOptimal ()) throw new RuntimeException ("An optimal solution was not found");
System.out.println (op.getPrimalSolution("x").toValue());
System.out.println("Total cost obtained: " + op.getOptimalCost());