I'm currently developing an Answer Set Programming problem, consisting in a robot that is needed to cover a room avoiding obstacles and reach a Goal point when all the room is covered. My idea was to transform the room map into asp predicates,in the form of room/3, being the parameters:
- X:x coord
- Y:y coord
- V:Value of the point in the room, being 0(initial point),1(point to cover),2(Obstacle),3(Goal point)
One of the criteria that the program must meet is to cover every point with a value of 1,which can be achieved with a constraint, but I do not know how to model the robot movement. My idea was to use a predicate of the form move/1,with up,down,left or right.
Can anybody help me guiding me in how to model this problem?
void map_to_asp(std::ofstream& file,std::vector<std::vector<char>>& room)
{
std::cout << room.size() << "," << room[0].size() << std::endl;
for(int i = 0; i < room.size(); i++)
{
for(int j = 0;j < room[0].size(); j++)
{
switch(room[i][j])
{
case '@':
file << "initial(" << i+1 << "," << j+1 << ").\n";
break;
case '.':
file << "toClean(" << i+1 << "," << j+1 << ").\n";
break;
case '#':
file << "obstacle(" << i+1 << "," << j+1 << ").\n";
break;
case 'X':
file << "goal(" << i+1 << "," << j+1 << ").\n";
break;
}
}
}
}
Thank you in advance.