New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extending MOEA with a simulation #157
Comments
Yes, when you create a problem (by implementing the How you implement this method depends on how your simulation model takes its inputs and writes its outputs. For example, suppose your simulation model uses an input file and produces an output file with the objectives. Your evaluate method would look like: public void evaluate(Solution solution) {
double[] vars = EncodingUtils.getReal(solution); // Assuming your decision variables are all reals
// Generate the input file with these variables
File file = new File("input.txt");
... create the input file ...
// Call your simulation model (if the model procures a lot of output, redirect the output stream to stdout)
Process p = Runtime.getRuntime().exec(new String[] { "mySimulation.exe", "-i", "input.txt", "-o", "output.txt" });
p.waitFor();
// Read the output file
File file = new File("output.txt");
... read the contents of the file ...
solution.setObjectives(...);
solution.setConstraints(...);
} Also take a look at Example5: http://moeaframework.org/examples.html#example5. This demonstrates the ExternalProblem class, which provides a simple mechanism to pass inputs to and read the outputs from a program. |
Thank you very much! |
This is an automated message. This issue is flagged as stale and will be closed in 7 days. If you feel this issue is still relevant, leave a comment to keep the issue open. Please also consider contributing a fix for the issue. |
Hi @dhadka,
I want to know if MOEA can be extended in such a way that a simulation model is used as the evaluation component within the framework. For example, if a GA is to be used as the solution algorithm, after initializing the first population, rather than evaluate the individuals with objective functions to get their determine their fitness, can a simulation rather be plugged in and utilized as the evaluation module after which the population is scored and control returns back to the GA for the reproduction process? Assuming the above example is not feasible can you describe how such an integration (MOEA with a simulation) might work.
Regards
The text was updated successfully, but these errors were encountered: