1 Star 0 Fork 0

道奥斯科技/JavaFF

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
GroundProblem.java 3.34 KB
一键复制 编辑 原始数据 按行查看 历史
YukariSonz 提交于 2020-02-07 16:46 +08:00 . Add CW
/************************************************************************
* Strathclyde Planning Group,
* Department of Computer and Information Sciences,
* University of Strathclyde, Glasgow, UK
* http://planning.cis.strath.ac.uk/
*
* Copyright 2007, Keith Halsey
* Copyright 2008, Andrew Coles and Amanda Smith
*
* (Questions/bug reports now to be sent to Andrew Coles)
*
* This file is part of JavaFF.
*
* JavaFF is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* JavaFF is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with JavaFF. If not, see <http://www.gnu.org/licenses/>.
*
************************************************************************/
package javaff.data;
import javaff.planning.STRIPSState;
import javaff.planning.MetricState;
import javaff.planning.TemporalMetricState;
import javaff.planning.RelaxedPlanningGraph;
import javaff.planning.RelaxedMetricPlanningGraph;
import javaff.planning.RelaxedTemporalMetricPlanningGraph;
import javaff.data.strips.InstantAction;
import javaff.data.temporal.DurativeAction;
import java.util.Set;
import java.util.HashSet;
import java.util.Map;
import java.util.Hashtable;
import java.util.Iterator;
public class GroundProblem
{
//public Set facts = new HashSet(); // (Proposition)
public Set actions = new HashSet(); // (GroundAction)
public Map functionValues = new Hashtable(); // (NamedFunction => BigDecimal)
public Metric metric;
public GroundCondition goal;
public Set initial; // (Proposition)
public TemporalMetricState state = null;
public GroundProblem(Set a, Set i, GroundCondition g, Map f, Metric m)
{
actions = a;
initial = i;
goal = g;
functionValues = f;
metric = m;
}
public STRIPSState getSTRIPSInitialState()
{
STRIPSState s = new STRIPSState(actions, initial, goal);
s.setRPG(new RelaxedPlanningGraph(this));
return s;
}
public MetricState getMetricInitialState()
{
MetricState ms = new MetricState(actions, initial, goal, functionValues, metric);
ms.setRPG(new RelaxedMetricPlanningGraph(this));
return ms;
}
public TemporalMetricState getTemporalMetricInitialState()
{
if (state == null)
{
Set na = new HashSet();
Set ni = new HashSet();
Iterator ait = actions.iterator();
while (ait.hasNext())
{
Action act = (Action) ait.next();
if (act instanceof InstantAction)
{
na.add(act);
ni.add(act);
}
else if (act instanceof DurativeAction)
{
DurativeAction dact = (DurativeAction) act;
na.add(dact.startAction);
na.add(dact.endAction);
ni.add(dact.startAction);
}
}
TemporalMetricState ts = new TemporalMetricState(ni, initial, goal, functionValues, metric);
GroundProblem gp = new GroundProblem(na, initial, goal, functionValues, metric);
ts.setRPG(new RelaxedTemporalMetricPlanningGraph(gp));
state = ts;
}
return state;
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/daoospi/JavaFF.git
git@gitee.com:daoospi/JavaFF.git
daoospi
JavaFF
JavaFF
master

搜索帮助