Exemplo n.º 1
0
 public void testModel() {
   Model model = null;
   File file = new File("models/simple.lua");
   try {
     model = Lua.newModel(file);
   } catch (ModelException e) {
     e.printStackTrace();
   } catch (IOException e) {
     e.printStackTrace();
   } catch (RuntimeException e) {
     e.printStackTrace();
     throw e;
   }
   System.out.println("name: " + model.getName());
   System.out.println("number of parameters: " + model.getNPar());
   System.out.println("number of variables: " + model.getNVar());
   System.out.println("description: " + model.getDescription());
 }
Exemplo n.º 2
0
 public void testLuaModel() {
   LuaModel model = null;
   File file = new File("models/simple.lua");
   try {
     model = (LuaModel) Lua.newModel(file);
   } catch (ModelException e) {
     e.printStackTrace();
   } catch (IOException e) {
     e.printStackTrace();
   } catch (RuntimeException e) {
     e.printStackTrace();
     throw e;
   }
   assertFalse(model.getHas_inverse() != 0);
   double[] result = new double[2];
   model.f(new double[] {1}, new double[] {0.5, 0.5}, result);
   assertTrue(0.25 == result[0]);
   assertTrue(0.25 == result[1]);
 }