bark-ml icon indicating copy to clipboard operation
bark-ml copied to clipboard

a strange error about '''boost''' library

Open tinmodeHuang opened this issue 3 years ago • 9 comments

I'm trying to merge the project with my algorithems, but an error popped up when running the one of algorithems, it is so hard for me to locate which code snippet causes the error, so I'm here for help. the error shows as follow:

python3: external/boost/boost/geometry/index/rtree.hpp:1469: 
void boost::geometry::index::rtree<Value, Options, IndexableGetter, EqualTo, Allocator>::raw_insert(const value_type&) [
with Value = std::pair<boost::geometry::model::box<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, unsigned int>; 
Parameters = boost::geometry::index::linear<16, 4>; 
IndexableGetter = boost::geometry::index::indexable<std::pair<boost::geometry::model::box<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, unsigned int> >;
EqualTo = boost::geometry::index::equal_to<std::pair<boost::geometry::model::box<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, unsigned int> >; 
Allocator = boost::container::new_allocator<std::pair<boost::geometry::model::box<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, unsigned int> >; 
boost::geometry::index::rtree<Value, Options, IndexableGetter, EqualTo, Allocator>::value_type = std::pair<boost::geometry::model::box<boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian> >, unsigned int>]: 
Assertion `(detail::is_valid(m_members.translator()(value)))&&("Indexable is invalid")' failed.

I'm willing if you ask me to post algorithems for solving it. thanks in advance!

tinmodeHuang avatar Nov 29 '21 02:11 tinmodeHuang

Without additional code or where it goes south this is difficult to debug. I would suggest you to debug into the Python/C++ code. As this error is related with the r-tree (https://github.com/bark-simulator/bark/blob/a5ad1044d40c3aa9600f496f64884bdd325ca9a0/bark/world/world.hpp#L217) it probably means that it is not updated.

patrickhart avatar Nov 30 '21 14:11 patrickhart

the error just occurs sometimes, so it is difficult to debug

tinmodeHuang avatar Dec 01 '21 06:12 tinmodeHuang

That probably means that an agent somehow is not available in the r-tree (possibly it got deleted going out of the map).

patrickhart avatar Dec 03 '21 07:12 patrickhart

after checking the code added by me over and over again and it could work very well in Hopper-v2, it seem to be concluded that there is something wrong in unmodified bark, bark-ml or their virtual environments

tinmodeHuang avatar Dec 30 '21 10:12 tinmodeHuang

All you probably need to do is to set this flag in the JSON: https://github.com/bark-simulator/bark-ml/blob/2fc969e5fa542f6ef02a67069a1b1c2be5ea788c/bark_ml/experiment/data/highway_gnn.json#L170

patrickhart avatar Dec 30 '21 11:12 patrickhart

just set it without any content, does it? if that is it or not, it remains to fail

tinmodeHuang avatar Dec 30 '21 12:12 tinmodeHuang

my code is simple, if you're willing, the error can be reproduced using it. operations to reproduce the error are as follows:

  1. extract lib_torch_mcdo.zip under /bark_ml/library_wrappers
  2. extract mcdo_rl.zip under /examples
  3. add the snippet below in /examples/BUILD
py_test(
  name = "mcdo_rl",
  srcs = ["mcdo_rl.py"],
  data = ["@bark_project//bark/python_wrapper:core.so",
          "//bark_ml:generate_core",
          "//examples/example_params:example_params"
        ],
  imports = ["../bark_ml/python_wrapper/"],
  deps = [
    "//bark_ml/commons:tracer",
    "//bark_ml/environments:gym",
    "//bark_ml/library_wrappers/lib_torch_mcdo:agents",
  ]
)
  1. run bazel run //examples:mcdo_rl -- --policy MCDO_TD3 --MC_dropout weighted_meanQ --seed 1

tinmodeHuang avatar Dec 30 '21 14:12 tinmodeHuang

The code is not executable since there are many local paths, etc.

To debug the problem, I would recommend:

  1. Run the same environment you want to train in with random actions (if the error does not occur, what does that entail?).
  2. Log the location, episode, action, etc. -> see where the error occurs (most probably when the ego agent or another agent goes out of bounds)
  3. The error most likely has something to do with a removed agent and a non-updated R-tree in BARK.

As I said before, set the parameter params["World"]["remove_agents_out_of_map"] = True for the BARK-ML environment. This enables the automatic removal of agents that are out-of-bounds.

patrickhart avatar Jan 05 '22 22:01 patrickhart

sorry for that, actually, you just replace /home/tinmode/bark-ml-master in all paths with whatever you want. thanks for these advices, I'll try to do it as you said.

tinmodeHuang avatar Jan 06 '22 02:01 tinmodeHuang