scikit-decide icon indicating copy to clipboard operation
scikit-decide copied to clipboard

AStar solver not implementing _solve_domain as expected

Open g-poveda opened this issue 2 years ago • 6 comments

the AStar solver :( skdecide/hub/solver/astar/astar.py ) doesn't seem to solve actually the domain when calling _solve_domain method. It just initialize internal solver (coded in cpp) but don't run the solve. This seems different from other hub solvers and scikit-decide api in general. (currently, the actual solving is when calling solve_from(memory))

g-poveda avatar Oct 20 '22 12:10 g-poveda

@g-poveda Could you develop about

This seems different from other hub solvers

?

Because, it seems to be the same behaviour for other c++ solvers (probably there are all wrong in that by the way):

  • aostar
  • bfws
  • ilaostar
  • iw
  • lrtdp
  • martdp
  • mcts
  • riw

The only c++ solver that seem to implement a real _solve_domain():

  • mahd

nhuet avatar Oct 09 '23 14:10 nhuet

@nhuet The pure python solvers in the hub : like ars, lazy_astar, lrtastar, cgp... all are launching the solving of the domain in the _solve_domain function, whereas the c++ ones not. I guess/think that the correct way is to do the solve in the _solve_domain.

g-poveda avatar Oct 09 '23 15:10 g-poveda

I would challenge that one and call for a discussion. We could also argue the opposite, i.e. that pure python solvers don't follow the c++-based solvers. The thing is that, with the python solvers's api, we have to define new domains each time we want to change just the initial state of the domain. Is this really what we want?

But in any case, I agree that we should agree on a common consistent behaviour but first discuss what should be this behaviour.

By the way, the same is valid for the solvers' constructors which have different signatures between pure python and C++-based solvers

fteicht avatar Oct 09 '23 20:10 fteicht

Ok agree @fteicht , i think i raised this issue to get more consistency and actually the solve_from() probably has its advantages.

g-poveda avatar Oct 09 '23 20:10 g-poveda

Agree. I propose to change the behaviour of the C++ solvers so that _solve_domain will actually call the solver if the domain provides a default initial state. If not, _solve_domain will continue just initializing the solver, whose search will be launched only when calling _solve_from (which is the current behaviour of all the C++ solvers).

fteicht avatar Nov 14 '23 09:11 fteicht

Also, the _solve_from method should have the same signature as the _is_solution_defined_for, i.e. observation: D.T_agent[D.T_observation].

fteicht avatar Feb 20 '24 09:02 fteicht

Solved by #320.

nhuet avatar May 21 '24 11:05 nhuet