GithubHelp home page GithubHelp logo

potassco / asprilo Goto Github PK

View Code? Open in Web Editor NEW
53.0 53.0 18.0 30.92 MB

🤖 ASPRILO, an intra-logistics benchmark suite for answer set programming

Home Page: https://asprilo.github.io/

License: MIT License

Python 99.54% Shell 0.46%

asprilo's People

Contributors

janheuer avatar pobermei avatar thomas-otto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

asprilo's Issues

Failed to connect with solver

Hi!
Initialize solver not able to connect to solver with the error

SAT
QGestureManager::deliverEvent: could not find the target for gesture
2022-02-03 21:56:02.179 python3.9[2362:153086] TSM AdjustCapsLockLEDForKeyTransitionHandling - _ISSetPhysicalKeyboardCapsLockLED Inhibit
Try connection with solver
Failed to connect with solver 
Retrying in 2 sek
Start solver
Failed to connect with solver 
Retrying in 2 sek
Failed to connect with solver 
Retrying in 2 sek
Failed to connect with solver 
Retrying in 2 sek
Failed to connect with solver 
Retrying in 2 sek
Failed to connect with solver
Close connection to solver

while Fast solve return error as

Connect with solver
Connection with: ('127.0.0.1', 51726)
<cmd>: error: file could not be opened:
  ./encoding.lp

Traceback (most recent call last):
  File "/Users/pratik/opt/miniconda3/envs/visualizer/bin/viz-solver", line 10, in <module>
    sys.exit(main())
  File "/Users/pratik/opt/miniconda3/envs/visualizer/lib/python3.9/site-packages/visualizer/solver.py", line 404, in main
    solver.run()
  File "/Users/pratik/opt/miniconda3/envs/visualizer/lib/python3.9/site-packages/visualizer/solver.py", line 277, in run
    if self.receive(1.0) != 0:
  File "/Users/pratik/opt/miniconda3/envs/visualizer/lib/python3.9/site-packages/visualizer/solver.py", line 157, in receive
    self.on_raw_data(self._raw_data)
  File "/Users/pratik/opt/miniconda3/envs/visualizer/lib/python3.9/site-packages/visualizer/solver.py", line 185, in on_raw_data
    self.on_data(self._data)
  File "/Users/pratik/opt/miniconda3/envs/visualizer/lib/python3.9/site-packages/visualizer/solver.py", line 222, in on_data
    if not self.solve().satisfiable:
  File "/Users/pratik/opt/miniconda3/envs/visualizer/lib/python3.9/site-packages/visualizer/solver.py", line 288, in solve
    self._control.load(self._args.encoding)
  File "/Users/pratik/opt/miniconda3/envs/visualizer/lib/python3.9/site-packages/clingo/control.py", line 363, in load
    _handle_error(_lib.clingo_control_load(self._rep, path.encode()))
  File "/Users/pratik/opt/miniconda3/envs/visualizer/lib/python3.9/site-packages/clingo/_internal.py", line 65, in _handle_error
    raise RuntimeError(msg)
RuntimeError: parsing failed
close solver
[Errno 57] Socket is not connected
Close connection to solver```

Visualizer: Error when trying to solve from visualizer

Debian 9(stretch), installed asprilo via conda
visualizer 0.2.0
clingo 5.3.0
'async_' is wrong key argument to clingo.control.solve(on_model = self.on_model, async_ = True)
in solver.py (egg file)

the error shows:
solve: 0
Traceback (most recent call last):
File "/home/david/anaconda3/envs/asprilo/bin/viz-solver", line 10, in
sys.exit(main())
File "/home/david/anaconda3/envs/asprilo/lib/python3.6/site-packages/visualizer-0.2.2-py3.6.egg/visualizer/solver.py", line 366, in main
File "/home/david/anaconda3/envs/asprilo/lib/python3.6/site-packages/visualizer-0.2.2-py3.6.egg/visualizer/solver.py", line 250, in run
File "/home/david/anaconda3/envs/asprilo/lib/python3.6/site-packages/visualizer-0.2.2-py3.6.egg/visualizer/solver.py", line 138, in receive
File "/home/david/anaconda3/envs/asprilo/lib/python3.6/site-packages/visualizer-0.2.2-py3.6.egg/visualizer/solver.py", line 164, in on_raw_data
File "/home/david/anaconda3/envs/asprilo/lib/python3.6/site-packages/visualizer-0.2.2-py3.6.egg/visualizer/solver.py", line 201, in on_data
File "/home/david/anaconda3/envs/asprilo/lib/python3.6/site-packages/visualizer-0.2.2-py3.6.egg/visualizer/solver.py", line 277, in solve
TypeError: 'async_' is an invalid keyword argument for this function
close solver

Error on Windows

I'm getting the following error, looks like it might be related to this:
https://stackoverflow.com/questions/52779920/why-is-signal-sigalrm-not-working-in-python-on-windows

I didn't find anything about OS support, is this supposed to work on Windows?
Here's the error:

(aspriloEnv) PS C:\Users\gnp89> gen -x 10 -y 20 -X 2 -Y 1 -s 20 -C --random Traceback (most recent call last): File "C:\Users\gnp89\.conda\envs\aspriloEnv\Scripts\gen-script.py", line 9, in <module> sys.exit(main()) File "C:\Users\gnp89\.conda\envs\aspriloEnv\lib\site-packages\generator-0.2.0-py3.6.egg\generator\__main__.py", line 11, in main File "C:\Users\gnp89\.conda\envs\aspriloEnv\lib\site-packages\generator-0.2.0-py3.6.egg\generator\control.py", line 74, in run File "C:\Users\gnp89\.conda\envs\aspriloEnv\lib\site-packages\generator-0.2.0-py3.6.egg\generator\control.py", line 84, in _run_once File "C:\Users\gnp89\.conda\envs\aspriloEnv\lib\site-packages\generator-0.2.0-py3.6.egg\generator\control.py", line 227, in _gen_basic File "C:\Users\gnp89\.conda\envs\aspriloEnv\lib\site-packages\generator-0.2.0-py3.6.egg\generator\generator.py", line 138, in generate AttributeError: module 'signal' has no attribute 'SIGALRM'

How to load a plan?

I tried to load instnaces and it worked.

But when I try to load plan, nothing is opened.

The example of plan is below:
%plan.txt
occurs(object(robot ,1),move (-1,0),1).
occurs(object(robot ,2),move (-1,0),1).
occurs(object(robot ,1),move (-1,0),2).
occurs(object(robot ,2),pickup ,2).

Generator: AttributeError: module 'signal' has no attribute 'SIGALRM'

The gen -h command runs, any attempt at generation yields the error.
Clingo and Generator installed through anaconda.
System:Windows 10

Console log:
Traceback (most recent call last):
File "C:\Users\Dalya\anaconda3\envs\myenv\Scripts\gen-script.py", line 9, in
sys.exit(main())
File "C:\Users\Dalya\anaconda3\envs\myenv\lib\site-packages\generator-0.2.0-py3.6.egg\generator_main_.py", line 11, in main
File "C:\Users\Dalya\anaconda3\envs\myenv\lib\site-packages\generator-0.2.0-py3.6.egg\generator\control.py", line 74, in run
File "C:\Users\Dalya\anaconda3\envs\myenv\lib\site-packages\generator-0.2.0-py3.6.egg\generator\control.py", line 84, in _run_once
File "C:\Users\Dalya\anaconda3\envs\myenv\lib\site-packages\generator-0.2.0-py3.6.egg\generator\control.py", line 227, in _gen_basic
File "C:\Users\Dalya\anaconda3\envs\myenv\lib\site-packages\generator-0.2.0-py3.6.egg\generator\generator.py", line 138, in generate
AttributeError: module 'signal' has no attribute 'SIGALRM'

Visualizer crashes when adding shelves in the UI

Environment:

  • qt 5.6.2
  • pyqt 5.6.0
  • clingo 5.2

Steps to reproduce:

  • load an instance (so far have only tried with tiny ones)
  • Start adding shelves to nodes

After some time (it's not always consistent), I get the below error. I'm including as much context as possible in the hopes that it's helpful.

$ ./visualizer/scripts/visualizer                                                                                                                                             
load file: /home/quickbeam/aspilro-instances/phillip/tiny_cases/4x4c/warehouse_x4_y4_n16_r3_s6_ps2_pr6_u12_o0_N1/x4_y4_n16_r3_s6_ps2_pr6_u12_o0_N1.lp
SAT
QXcbConnection: XCB error: 3 (BadWindow), sequence: 888, resource id: 2097424, major code: 40 (TranslateCoords), minor code: 0
Traceback (most recent call last):
  File "/home/quickbeam/code/asprilo/visualizer/scripts/../visualizer/modelView.py", line 171, in event
    ss += '\n' + item.get_name() + '('+ item.get_id() +')'
TypeError: cannot concatenate 'str' and 'int' objects
[1]    3039 abort (core dumped)  ./visualizer/scripts/visualizer

Visualizer: Store Settings in $HOME/.config/visualizer

Currently, the visualizer settings are stored relative to the current working directory in ./config/init/

Instead, store all settings under $HOME/.config/asprilo/visualizer/ where `$HOME' is the home directory of the current user, as per usual.

Generator error

I got the following error message when using the asprilo generator:

Traceback (most recent call last):
File "C:\Users\Adrian\anaconda3\Scripts\gen-script.py", line 9, in
sys.exit(main())
File "C:\Users\Adrian\anaconda3\lib\site-packages\generator-0.2.0-py3.6.egg\generator_main_.py", line 11, in main
File "C:\Users\Adrian\anaconda3\lib\site-packages\generator-0.2.0-py3.6.egg\generator\control.py", line 74, in run
File "C:\Users\Adrian\anaconda3\lib\site-packages\generator-0.2.0-py3.6.egg\generator\control.py", line 84, in _run_once
File "C:\Users\Adrian\anaconda3\lib\site-packages\generator-0.2.0-py3.6.egg\generator\control.py", line 227, in _gen_basic
File "C:\Users\Adrian\anaconda3\lib\site-packages\generator-0.2.0-py3.6.egg\generator\generator.py", line 138, in generate
AttributeError: module 'signal' has no attribute 'SIGALRM'

I am using Windows 10 and anaconda 3 with a terminal. The generator version is 0.3.0.
The command I used was: gen -x 5 -y 3
but I also tried different commands, including the ones provided as an example in the readme. The error message was always the same.

conda installation throws errors

Running 'conda install asprilo-visualizer' on fedora throws errors:

Collecting package metadata (current_repodata.json): done
Solving environment: -
The environment is inconsistent, please check the package plan carefully
The following packages are causing the inconsistency:

UnsatisfiableError: The following specifications were found to be incompatible with each other:

  • pip -> python[version='>=3.6,<3.7.0a0']

Visualizer: write config files into default location

At the moment, the visualizer writes at invocation a config directory in the working directory. Ideally, it would store all its config files in a single place by default, e.g. ~/.config/asprilo/visualizer/~

Visualizer crash on rightclick

When rightclicking the lower box appearing when using the order tool (Menustrip: Tools--> Orders) first the tool gets stuck to the curser as if dragging to a new position then the tool closes and then the whole visualizer crashes.
This happens with or without a loaded instance.

viz-solver requires python <3.8 but the visualizer requires >=3.9

the visualizer/solver.py file uses the time.clock() function which is deprecated since python 3.8. so when I run viz-solver, I get the error:
File ".../visualizer/solver.py", line 59, in __init__ self._solve_start = time.clock() AttributeError: module 'time' has no attribute 'clock'

Error when trying to solve from visualizer

I have a strong suspicion that this is related to an issue I posted earlier, but since there hasn't been any response there and I'm not completely sure my guess is correct, I'm opening a separate ticket here.

I'm running clingo 5.2.0, because I can't find any mention of version 5.3...
Whenever I try to solve an instance from the visualizer, I get the following error.

Connection with: ('127.0.0.1', 44162)
ground: 0
solve: 0
Traceback (most recent call last):
  File "/home/quickbeam/code/asprilo/visualizer/scripts/solver_inc.py", line 43, in <module>
    solver.run()
  File "/home/quickbeam/code/asprilo/visualizer/scripts/network.py", line 98, in run
    if self.receive(1.0) is '':
  File "/home/quickbeam/code/asprilo/visualizer/scripts/network.py", line 56, in receive
    self.on_raw_data(self._raw_data)
  File "/home/quickbeam/code/asprilo/visualizer/scripts/network.py", line 123, in on_raw_data
    self.on_data(self._data)
  File "/home/quickbeam/code/asprilo/visualizer/scripts/solver.py", line 25, in on_data
    if self.solve() < 0:
  File "/home/quickbeam/code/asprilo/visualizer/scripts/solver_inc.py", line 25, in solve
    solve_future = self._control.solve_async(self.on_model)
AttributeError: 'clingo.Control' object has no attribute 'solve_async'
close solver
Close connection to solver

Solving from the visualizer

Hi
When I try to solve from the visualizer directly, I am not getting a solution although in terminal it is mentioned that solution found. All occurs atoms are not present when being passed to the solver and I am getting the following warning.
image
Any help on this would be appreciated.

Problem installing the Visualizer

I have an issue using the asprilo visualizer.
I use the asprilo visualizer via anaconda on windows 10.
Opening, using and saving instances wasn’t a problem but when I tried to save an instance I would always get this Error:

„attributeerror: 'control' object has no attribute 'builder'“.

After a bit of research I thought this might have something to do with the current python version that anaconda uses. But when I tried to update python anaconda would say: „all requested packages already installed“.

I also tried uninstalling and reinstalling the asprilo visualiser itself but when I tried to install it again, it would give the following error:

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  • asprilo-visualizer
    -> python[version='>=3.9']

Your python: python=3.7

I also tried to install a specific version of python via “conda install python=3.9”. But doing so, seems to make it stuck in a loop when this line appears:
[04:22<00:03, 2.59it/s]/Examining conflict for conda-content-trust cycler ipython_genutils idna prompt-toolkit backports.shutil_get_terminal_\

I don’t know a lot about how anaconda works so any help is verry appreciated.

Name Conventions for Windows

In the generator/generator/utils path there is a file named aux.py. Windows has a few reserved file-names, one of which is aux, preventing any files of this name to exist or be created. Nothing big, just some renaming and manual creation of the file, but i thought it would be nice to know and maybe fix in the future.

double declared fields

The instance file

instances/standard_cases/4/warehouse_x10_y10_n100_r4_s12_ps3_pr3_u20_o0_N1/merged/x10_y10_n100_r4_s12_ps3_pr3_u20_o5_N10.lp

has (6,1) marked as both picking station and highway

Undefined variable in `finally` clause

The finally clause here references a variable igen which is not always defined.

I haven't had time to look into how to fix this, but I'm guessing @pobermei can probably find it much quicker, being much more familiar with the code.

Inconsistency m-domain solutionChecker

In the m-domain solution-checker, the two checks perfomed in the a-domain static.lp are not included:

% At most one object of the same type (robot. shelf, picking station, etc.)  may occupy a node at
% the same time, otherwise collision.
err(static, collNode, (OT, X, Y, T))      :- { holds(object(OT, _),     value(at, (X, Y)), T) } > 1;
                                             holds(object(node, _), value(at, (X, Y)),     T);
                                             init( object(OT,   _), _);
                                             time(T).


% Two adjacent objects of the same type (robots, shelves) must not swap places in one step, i.e,
% they would collide.
err(static, collSwap, (OT, R1, R2, T))    :- holds(object(OT, R1), value(at, (X1, Y1)), T);
                                             holds(object(OT, R2), value(at, (X2, Y2)), T);
                                             holds(object(OT, R1), value(at, (X2, Y2)), T-1);
                                             holds(object(OT, R1), value(at, (X1, Y1)), T-1);
                                             R1<R2, |X2-X1|+|Y2-Y1|==1.

In the specification, there was not mentioned, that these two cases do not apply for the m-domain. So I think it should be either mentioned in the specification explicitly or the two checks should be included in the m-domain checker.

core dump when saving handcrafted instance

torsten@bono 2010:~/ASP/asprilo> visualizer
Traceback (most recent call last):
File "/home/torsten/local/bin/visualizer", line 338, in save_instance
file_name = self._file_dialog.selectedFiles()[0]
IndexError: list index out of range
Aborted (core dumped)

Maximizing the number of shelves in reachable layout

Sorry about the issue spam, but I just want to confirm something. When the generator produces instances with a reachable layout, does it try to maximize the number of shelves? I don't see anything about this in ig.lp or ig.py, but maybe I'm missing something.

Thanks!

Solution-Checker two robots carrying same shelf

The a-domain solution checker is not detecting the following case:
Instance:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Grid size X: 2
%Grid size Y: 2
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#program base.

%init
init(object(node, 2), value(at, (2, 1))).
init(object(node, 4), value(at, (2, 2))).
init(object(node, 3), value(at, (1, 2))).
init(object(node, 1), value(at, (1, 1))).
init(object(pickingStation,1), value(at,(1,1))).
init(object(robot,1), value(at,(1,2))).
init(object(robot,2), value(at,(2,1))).
init(object(shelf,1), value(at,(2,2))).
init(object(product,1),value(on,(1,1))).
init(object(order,1),value(pickingStation,1)).init(object(order,1),value(line,(1,1))).

pickupDifferentRobot

Plan:

occurs(object(robot,1),action(move,(1,0)),1).
occurs(object(robot,1),action(pickup,()),2).
occurs(object(robot,2),action(move,(0,1)),3).
occurs(object(robot,1),action(move,(-1,0)),3).
occurs(object(robot,2),action(pickup,()),4).
occurs(object(robot,1),action(move,(0,-1)),4).
occurs(object(robot,2),action(putdown,()),5).
occurs(object(robot,1),action(deliver,(1,1,1)),5).

no mistake is detected even though the same shelf is picked up twice.
when you add the statement #show holds(object(robot, R), value(carries, S), T): holds(object(robot, R), value(carries, S), T).
You get

holds(object(robot,1),value(carries,1),2) holds(object(robot,1),value(carries,1),3) holds(object(robot,1),value(carries,1),4) holds(object(robot,2),value(carries,1),4) holds(object(robot,1),value(carries,1),5)

At timestep 4 robot 1 and 2 are carrying the shelf 1.
There is missing a mechanism for updating the shelf positions after pickup and putdown.

Handling optimizations in generator

I'm trying to add some custom constraints over the instances generated automatically and these constraints include an optimization statement. Currently the generator simply selects the first model derived without making sure it has the optimal cost value.

Is there anything equivalent to clingo's --outf=1 flag available already? I can't seem to find anything currently. the API docs say it's not supported directly, i.e. it would have to be implemented on the Python side of things.

Solution-Checker wrongPickingStation

I think there is a case that is not detected properly by the a-domain solution checker. Consider the following instance:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Grid size X: 4
%Grid size Y: 1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#program base.

%init
init(object(node, 2), value(at, (2, 1))).
init(object(node, 3), value(at, (3, 1))).
init(object(node, 4), value(at, (4, 1))).
init(object(node, 1), value(at, (1, 1))).
init(object(pickingStation,1), value(at,(1,1))).
init(object(pickingStation,2), value(at,(4,1))).
init(object(shelf,1), value(at,(2,1))).
init(object(product,1),value(on,(1,2))).
init(object(robot,1), value(at,(3,1))).
init(object(order,1),value(pickingStation,1)).
init(object(order,1),value(line,(1,1))).
init(object(order,2),value(pickingStation,2)).
init(object(order,2),value(line,(1,1))).

instance

Now consider the following plan:

occurs(object(robot,1),action(move,(-1,0)),1).
occurs(object(robot,1),action(pickup,()),2).
occurs(object(robot,1),action(move,(-1,0)),3).
occurs(object(robot,1),action(deliver,(1,1,1)),4).
occurs(object(robot,1),action(deliver,(2,1,1)),5).

This plan is not correct, because order 2 need to be delivered to pickingStation 2 and not to pickingStation 1.
But still the checker/encodings/a/checker.lp does not detect an error.
I think the rule that was inteded to cover this case is the following rule in the file action-deliver.lp

% Robot delivers product that is not requested at picking stations
err(deliver, noOrder, (R, T)) :-     occurs(object(robot,           R ), action(deliver,         (O, P, _)), T  );
                                     holds( object( robot,          R ), value( at,              (X, Y)   ), T-1);
                                     holds( object( pickingStation, PS), value( at,              (X, Y)   ), T-1);
                                     holds( object(order,           O ), value( pickingStation,  PS       ), T-1);
                                 not holds(object(order,            O ), value( line,            (P, _)   ), T-1).

Why does this rule not apply? Well if put in the corresponding value for checking the action of T=5, we get the following rule:

% Robot delivers product that is not requested at picking stations
err(deliver, noOrder, (R, T)) :-     occurs(object(robot, R=1 ), action(deliver,         (O=2, P=1, _)), T =5 );
                                     holds( object( robot,          R =1), value( at,              (X=1, Y=1)   ), T=4);
                                     holds( object( pickingStation, PS=1), value( at,              (X=1, Y=1)   ), T=4);
                                     holds( object(order,           O =2), value( pickingStation,  PS  =1     ), T=4);
                                 not holds(object(order,            O =2), value( line,            (P=1, _)   ), T=4).

The atom that doesn't apply is the line 4 holds( object(order, O =2), value( pickingStation, PS =1 ), T=4);. Therefore, the wrong pickingStation is not detected.

This could be fixed by added an additional rule like for example:

err(deliver, wrongStation, (R, T)) :-     occurs(object(robot,           R ), action(deliver,         (O, _, _)), T  );
                                     holds( object( robot,          R ), value( at,              (X, Y)   ), T-1);
                                     holds( object( pickingStation, PS), value( at,              (X, Y)   ), T-1);
                                     not holds( object(order,           O ), value( pickingStation,  PS       ), T-1).

adding orders

I managed to edit and save a new layout
but how do I add an order?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.