|
MOEA Framework 2.12 API Specification |
|||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.moeaframework.problem.ScriptedProblem
public class ScriptedProblem
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.
Constructor Summary | |
---|---|
ScriptedProblem(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 | |
---|---|
void |
close()
Closes any underlying resources used by this problem. |
void |
evaluate(Solution solution)
Evaluates the solution, updating the solution's objectives in place. |
String |
getName()
Returns the user-friendly name for this problem. |
int |
getNumberOfConstraints()
Returns the number of constraints defined by this problem. |
int |
getNumberOfObjectives()
Returns the number of objectives defined by this problem. |
int |
getNumberOfVariables()
Returns the number of decision variables defined by this problem. |
Solution |
newSolution()
Returns a new solution for this problem. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ScriptedProblem(String script, String name) throws ScriptException
script
- the scriptname
- the name of the scripting engine
ScriptException
- if an error occurred in the Scripting APIspublic ScriptedProblem(Reader reader, String name) throws ScriptException
reader
- the reader for loading the script contentsname
- the name of the scripting engine
ScriptException
- if an error occurred in the Scripting APIspublic ScriptedProblem(File file) throws ScriptException, IOException
file
- the file containing the script contents, and whose file
extension identifies the scripting language
ScriptException
- if an error occurred in the Scripting APIs
IOException
- if an I/O error occurredMethod Detail |
---|
public String getName()
Problem
getName
in interface Problem
public int getNumberOfVariables()
Problem
getNumberOfVariables
in interface Problem
public int getNumberOfObjectives()
Problem
getNumberOfObjectives
in interface Problem
public int getNumberOfConstraints()
Problem
getNumberOfConstraints
in interface Problem
public void evaluate(Solution solution)
Problem
evaluate
in interface Problem
solution
- the solution to be evaluatedpublic Solution newSolution()
Problem
newSolution
in interface Problem
public void close()
Problem
close
in interface Problem
|
MOEA Framework 2.12 API Specification |
|||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |