Published in the Jacaranda blog.
An interface to Jacaranda from Octave (a tool similar to, and often very compatible with, Matlab) is potentially very useful, especially in the context of optimisation. Jacaranda provides a framework for process definitions, including simple or complex physical properties and processing units. Although Jacaranda has a number of optimisation methods included, it is not meant to be all-encompassing. As much of the optimisation research world-wide uses Octave or Matlab, an interface from Octave (due to its open source nature in preference to the proprietary and closed source Matlab) can be useful.
Previous versions of Jacaranda have included such an interface. However, the interface was based on the use of socket communication which could be slow when many objective function evaluations were required. It was also not a very portable solution which, although not often an issue (Jacaranda runs well on almost any Linux distribution), there is not reason to be limiting in portability.
Recently, a generic interface from Octave to Java has been implemented by Michael Goffioul. Jacaranda has therefore been updated to make use of this interface as it provides a much more elegant solution than what Jacaranda had before and is also more efficient.
The full Jacaranda distribution (provided to collaborators) includes an input file which demonstrates this interface. As the more general distribution does not include this particular input file, I include it here for illustration:
1 ## Test out the Octave Java interface to Jacaranda.
2 ##
3 ## Eric S Fraga
4 function jacaranda_test
5 persistent version;
6 if (isempty(version))
7 version = "2008.08.05 23:55:43";
8 printf ("ESF %s, Octave java to Jacaranda function evaluation\n", version)
9 endif
10 ## initialise the Jacaranda interface from Octave, using a test input
11 ## file which defines an appropriate objective function. The
12 ## particular example, from Rathore et al (1974) is the design of a
13 ## heat integrated distillation sequence. The input file will
14 ## generate at least one flowsheet design. This flowsheet will define
15 ## an objective function with 8 real optimisation variables and 3
16 ## criteria for optimisation.
17 ##
18 ## Note that the following assumes that the Jacaranda class files are
19 ## stored in the given location relative to this file and that,
20 ## therefore, Octave has been started in this directory.
21 [A B nx ny nf] = jacaranda_init ("../vle/rathore_hen.in", \ # input file
22 "rathore_hen-1-1", \ # objective function
23 "../../src/java") # Jacaranda classpath
24 ## now evaluate the flowsheet at a number of random points
25 N = 100;
26 Y = [];
27 n_infeasible = 0;
28 for i=1:N
29 x = A + rand(1,length(A)).*(B-A);
30 try
31 y = jacaranda_evaluate (x);
32 Y = [Y; y];
33 catch
34 n_infeasible++;
35 end_try_catch
36 endfor
37 if n_infeasible > 0
38 printf ("There were %d infeasible design points (out of %d total) found.\n", n_infeasible, N);
39 endif
40 printf ("Minimum criteria values: %8.2e %8.2e %8.2e\n", min(Y));
41 printf ("Maximum criteria values: %8.2e %8.2e %8.2e\n", max(Y));
42 ## the results obtained above are plotted to give some indication of
43 ## the variation in the three criteria for random design points
44 plot (Y);
45 endfunction
I believe the comments describe clearly what is happening so I will leave it at this for now.