我是一名从中国开始学习SHOP2的学生。我的老师告诉我在Eclipse中运行JSHOP2。现在我可以运行原始的zenotravel问题并生成GUI和计划。同样,我想将其他领域和问题放到SHOP2并生成计划。但问题是我不知道如何编译它们,我的老师只要求我在 Internaldomain 中运行 main 函数但它不能成功。以下是原始代码:
public static void main(String[] args) throws Exception
{
//compile();
// compile(args);
//-- run the planning algorithm
run(args);
}
此代码可以运行zenotravel。然后我将域和问题分别命名为pfile1和tdepots到SHOP2文件夹中。将代码更改为:
{
compile(domaintdepots);
// compile(args);
//-- run the planning algorithm
run(args);
}
它警告“域pdf文件无法解析为变量”。
或者
//--compile();
compile(args);
//-- run the planning algorithm
//run(args);
事实证明:
"Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at JSHOP2.InternalDomain.compile(InternalDomain.java:748)
at JSHOP2.InternalDomain.main(InternalDomain.java:720)"
720是上面的主要功能。而748是编译功能:
public static void compile(String[] args) throws Exception
{
//-- The number of solution plans to be returned.
int planNo = -1;
//-- Handle the number of solution plans the user wants to be returned.
if (args.length == 2 || args[0].substring(0, 2).equals("-r")) {
if (args[0].equals("-r"))
planNo = 1;
else if (args[0].equals("-ra"))
planNo = Integer.MAX_VALUE;
else try {
planNo = Integer.parseInt(args[0].substring(2));
} catch (NumberFormatException e) {
}
}
最后,根据朋友的建议,我把这两个pddl放到src文件夹下,在CMD命令中使用“java Jshop2.InternalDomain domaintdepots”却出现错误:“main class Interdomain can't be found or loaded”。但是我已经准确地设置了类路径,Zenotravel 规划可以运行了。那么该命令在哪里以及如何使用?Eclipse 中括号“compile()”中写的是什么?</p>
我也不熟悉JAVA,所以如果有具体的说明会更好。非常感谢。