Common problems¶
Explanation of different problems, errors and exceptions that may be found while using the framework.
IllegalStateException: No language ...¶
An exception such as:
Exception in thread "Thread-2" java.lang.IllegalStateException: No language and polyglot implementation was found on the classpath. Make sure the truffle-api.jar is on the classpath.
at org.graalvm.polyglot.Engine$PolyglotInvalid.noPolyglotImplementationFound(Engine.java:1001)
at org.graalvm.polyglot.Engine$PolyglotInvalid.createHostAccess(Engine.java:991)
at org.graalvm.polyglot.Engine$Builder.build(Engine.java:626)
at org.graalvm.polyglot.Context$Builder.build(Context.java:1827)
at es.urjc.etsii.grafo.autoconfig.irace.runners.GraalRLangRunner.lambda$execute$0(GraalRLangRunner.java:45)
at java.base/java.lang.Thread.run(Thread.java:833)
irace.shell
is false.
There are two options to fix the previous problem:
- A: Install R locally and set irace.shell=true
- B: Install GraalVM and launch the application using GraalVM, instead of the standard JVM.
The algorithm X does not have public constructors¶
Algorithms that do not have public constructors use the builder pattern. Use the static method, example: SimulatedAnnealing.builder()
.
RuntimeException: Could not found Solution constructor Solution(Instance)¶
By default, the framework finds the solution class implementation, the instance implementation, and automatically initializes solutions under demand using the following solution class constructor:
public class MySolution extends Solution<MySolution, MyInstance>{
// fields, etc
public MySolution(MyInstance instance){
// Initialize fields, etc
}
// other methods
}
All the previous cases are easily fixed by explaining to the framework how to initialize solutions for an instance. The only required step is extending the class SolutionBuilder, which determines how solutions are initialized. Example:
public class MyProblemSolutionBuilder extends SolutionBuilder<VRPODSolution, VRPODInstance> {
@Override
public MySolution initializeSolution(MyInstance instance) {
return new MySolution(instance, param1, param2, etc);
}
}
If a custom SolutionBuilder implementation is provided by the user, the default strategy is automatically disabled.