has*_*kos 2 answer-set-programming clingo
我不确定如何在 clingo4(ASP 求解器)中编写优化语句。
我想最小化每个答案集中某些文字的实例总数。
我正在 ASP 中模拟火灾响应代理。代理可以选择在不同时间执行某些简单的操作,例如:
0{call_fire_department(Area, Time, Time+1)}1:- [preconditions].
0{send_security_guard(Guard, Area, Time, Time+1)}1:- [preconditions].
0{activate_fire_suppression(Area, Time, Time+1)}1:- [preconditions].
Run Code Online (Sandbox Code Playgroud)
代理有目标,需要在特定时间混合执行上述操作。我希望最大限度地减少上述每种情况的实例数量,同时仍然实现代理目标。
如何编写适当的优化语句?(我假设我需要一个“最小化”声明)。
谢谢。
怎么样
#minimize{
1, call, Area, Time : call_fire_department(Area, Time, Time+1) ;
1, send, Guard, Area, Time : send_security_guard(Guard, Area, Time, Time+1) ;
1, activate, Area, Time : activate_fire_suppression(Area, Time, Time+1)
}.
Run Code Online (Sandbox Code Playgroud)
activate_file_suppression(foo, 20, 21),call_fire_department(foo, 20, 21)将合并到集合中。