Package org.moeaframework.problem
Class ScriptedProblem
java.lang.Object
org.moeaframework.problem.ProblemWrapper
org.moeaframework.problem.ScriptedProblem
- All Implemented Interfaces:
AutoCloseable
,Problem
Permits interfacing with problems implemented by one of the many scripting languages supported by the Java Scripting
APIs.
Currently, only scripting engines which support the Invocable
interface are supported. The script itself
should contain methods equivalent to the methods in Problem
, with the same names, arguments and return
values.
-
Field Summary
Fields inherited from class org.moeaframework.problem.ProblemWrapper
problem
-
Constructor Summary
ConstructorDescriptionScriptedProblem
(File file) Constructs a new problem implemented in a scripting language.ScriptedProblem
(Reader reader, String name) Constructs a new problem implemented in a scripting language.ScriptedProblem
(String script, String name) Constructs a new problem implemented in a scripting language. -
Method Summary
Methods inherited from class org.moeaframework.problem.ProblemWrapper
close, evaluate, getName, getNumberOfConstraints, getNumberOfObjectives, getNumberOfVariables, newSolution
-
Constructor Details
-
ScriptedProblem
Constructs a new problem implemented in a scripting language.- Parameters:
script
- the scriptname
- the name of the scripting engine- Throws:
ScriptException
- if an error occurred in the Scripting APIs
-
ScriptedProblem
Constructs a new problem implemented in a scripting language.- Parameters:
reader
- the reader for loading the script contentsname
- the name of the scripting engine- Throws:
ScriptException
- if an error occurred in the Scripting APIs
-
ScriptedProblem
Constructs a new problem implemented in a scripting language.- Parameters:
file
- the file containing the script contents, and whose file extension identifies the scripting language- Throws:
ScriptException
- if an error occurred in the Scripting APIsIOException
- if an I/O error occurred
-