moses icon indicating copy to clipboard operation
moses copied to clipboard

MOSES example moses-ann-pole1 segmentation fault

Open cosmoharrigan opened this issue 8 years ago • 17 comments

I receive a segmentation fault when I run the MOSES example program moses-ann-pole1 on Ubuntu 14.04.1 with GCC 4.8.4.

Preparation: mkdir build cd build ; cmake -DCMAKE_BUILD_TYPE=Debug .. ; make make examples cd ../examples/example-progs

Start gdb: gdb moses-ann-pole1

Run the program: (gdb) run 100 1

Starting program: /home/cosmo/moses/build/examples/example-progs/moses-ann-pole1 100 1
Traceback (most recent call last):
  File "/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19-gdb.py", line 63, in <module>
    from libstdcxx.v6.printers import register_libstdcxx_printers
ImportError: No module named 'libstdcxx'
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff0d9b700 (LWP 17457)]

Program received signal SIGSEGV, Segmentation fault.
0x000000000046c0b4 in std::char_traits<char>::length (__s=0x0) at /usr/include/c++/4.8/bits/char_traits.h:259
259       { return __builtin_strlen(__s); }

(gdb) backtrace

#0  0x000000000046c0b4 in std::char_traits<char>::length (__s=0x0) at /usr/include/c++/4.8/bits/char_traits.h:259
#1  0x000000000047a8b9 in boost::detail::lexical_stream_limited_src<char, std::char_traits<char>, false>::shl_char_array (this=0x7fffffffc9d0, str=0x0) at /usr/include/boost/lexical_cast.hpp:1591
#2  0x0000000000478827 in boost::detail::lexical_stream_limited_src<char, std::char_traits<char>, false>::operator<< (this=0x7fffffffc9d0, str=0x0) at /usr/include/boost/lexical_cast.hpp:1818
#3  0x00000000004755bc in boost::detail::lexical_cast_do_cast<double, char*>::lexical_cast_impl (arg=@0x7fffffffd660: 0x0) at /usr/include/boost/lexical_cast.hpp:2354
#4  0x0000000000472229 in boost::lexical_cast<double, char*> (arg=@0x7fffffffd660: 0x0) at /usr/include/boost/lexical_cast.hpp:2523
#5  0x000000000046b405 in main (argc=3, argv=0x7fffffffd648) at /home/cosmo/moses/examples/example-progs/moses-ann-pole1.cc:58

cosmoharrigan avatar Nov 11 '15 03:11 cosmoharrigan

Here's the line where it occurs: https://github.com/opencog/moses/blob/master/examples/example-progs/moses-ann-pole1.cc#L58

cosmoharrigan avatar Nov 11 '15 03:11 cosmoharrigan

The program says that it should be invoked as usage: moses-ann-pole1 maxevals seed but it looks as though it actually expects to receive 6 command line arguments: max evals, seed, stepsize, expansion, depth, reduce https://github.com/opencog/moses/blob/master/examples/example-progs/moses-ann-pole1.cc#L58

cosmoharrigan avatar Nov 11 '15 04:11 cosmoharrigan

If I try running it with 6 command line arguments, then I receive an error

terminate called after throwing an instance of 'opencog::AssertionException'
  what():   (/home/cosmo/moses/moses/comboreduct/reduct/../combo/convert_ann_combo.h:117)
Aborted (core dumped)

https://github.com/opencog/moses/blob/master/moses/comboreduct/combo/convert_ann_combo.h#L117

Any suggestions?

cosmoharrigan avatar Nov 11 '15 04:11 cosmoharrigan

I can't replicate it now (not in my computer right now), but let me try help you. For the first error you already figure it out.

On Wed, Nov 11, 2015 at 1:48 AM, Cosmo Harrigan [email protected] wrote:

If I try running it with 6 command line arguments, then I receive an error

terminate called after throwing an instance of 'opencog::AssertionException' what(): (/home/cosmo/moses/moses/comboreduct/reduct/../combo/convert_ann_combo.h:117) Aborted (core dumped)

https://github.com/opencog/moses/blob/master/moses/comboreduct/combo/convert_ann_combo.h#L117

Any suggestions?

— Reply to this email directly or view it on GitHub https://github.com/opencog/moses/issues/26#issuecomment-155662193.

ArleyRistar avatar Nov 11 '15 04:11 ArleyRistar

For this second, could you put the values that you tried?

ArleyRistar avatar Nov 11 '15 04:11 ArleyRistar

Thanks @arleyristar. For example, I tried

./moses-ann-pole1 10 1 1 2 5 1

After executing it, it freezes; and then, if you press enter, it displays that stack trace and terminates.

cosmoharrigan avatar Nov 11 '15 05:11 cosmoharrigan

It should have worked, these are basically default values. Could you try another examples?

On Wed, Nov 11, 2015 at 2:09 AM, Cosmo Harrigan [email protected] wrote:

Thanks @arleyristar https://github.com/arleyristar. For example, I tried

./moses-ann-pole1 10 1 1 2 5 1

After executing it, it freezes; and then, if you press enter, it displays that stack trace and terminates.

— Reply to this email directly or view it on GitHub https://github.com/opencog/moses/issues/26#issuecomment-155668065.

ArleyRistar avatar Nov 11 '15 05:11 ArleyRistar

Sorry for the delay, my crap hotel internet isn't helping. So, for the line that you said, it's trying to decode a tree that is empty... I've changed this examples for last, but it was a simple thing and it was working before (Linas wouldn't accept my commit if not). Maybe tomorow I'll try to find what broke it, if Linas or Nil don't see it first.

On Wed, Nov 11, 2015 at 2:18 AM, Arley Ristar [email protected] wrote:

It should have worked, these are basically default values. Could you try another examples?

On Wed, Nov 11, 2015 at 2:09 AM, Cosmo Harrigan [email protected] wrote:

Thanks @arleyristar https://github.com/arleyristar. For example, I tried

./moses-ann-pole1 10 1 1 2 5 1

After executing it, it freezes; and then, if you press enter, it displays that stack trace and terminates.

— Reply to this email directly or view it on GitHub https://github.com/opencog/moses/issues/26#issuecomment-155668065.

ArleyRistar avatar Nov 11 '15 05:11 ArleyRistar

If you guys start using the NN part, please by all means, add a unit test for it. The lack of unit test is the reason this code has gotten broken over time.

ngeiswei avatar Nov 11 '15 05:11 ngeiswei

@ngeiswei Indeed; perhaps it would make sense to use one of the existing NN examples as a unit test?

cosmoharrigan avatar Nov 11 '15 05:11 cosmoharrigan

@arleyristar The unit tests all pass. It would be great if you can try this out on your machine when you get back.

cosmoharrigan avatar Nov 11 '15 06:11 cosmoharrigan

Yes indeed there is some ANN unit test. Once you understand the problem you should complete the unit test to cover that case, or as @cosmoharrigan suggests create a unit test based on the example.

ngeiswei avatar Nov 11 '15 08:11 ngeiswei

Do these examples even make sense? It wasn't clear to me that the ANN examples were any good. Note also: now that the POS (particle-swarm-optimization) code is integrated, doesn't that change the motivation to use ANN's in moses? The examples should include some description as to why they are worthy.

linas avatar Nov 11 '15 14:11 linas

Do these examples even make sense?

@linas In what sense? From an abstract point of view, the pole balancing/inverted pendulum problem is a classic benchmark in control theory. But, I don't know about the specifics of how these examples were implemented.

cosmoharrigan avatar Nov 11 '15 22:11 cosmoharrigan

I meant "do they use moses in a way that makes sense; i.e. do they actually demonstrate something that moses would be good at solving (as opposed to using moses as a fancy random-number generator)"

--linas

On Thu, Nov 12, 2015 at 12:58 AM, Cosmo Harrigan [email protected] wrote:

Do these examples even make sense?

@linas https://github.com/linas In what sense? From an abstract point of view, the pole balancing/inverted pendulum problem is a classic benchmark in control theory. But, I don't know about the specifics of how these examples were implemented.

— Reply to this email directly or view it on GitHub https://github.com/opencog/moses/issues/26#issuecomment-155936423.

linas avatar Nov 12 '15 14:11 linas

So, I replicated the "error" here. In these examples, you are supposed to pass the seed tree (cin >> tr, line 72), so when you press enter you are passing an empty tree, leading to this "error". About the usage: I don't know if moses-ann-pole1 was copied from another example (leaving the usage with a wrong msg), but some others examples, like moses-ann-pole2, uses maxevals, seed and the default value of 1.25, 1.5, 4 and true for the rest. I don't know much about this part, but for the seed tree in the xor example you could starting passing something like: ann($I2 $I3 1 0) or ann($N1($N2($I3 $I4 -1 1) $I3 $I4 1 -1 0.5))

So, Linas or Nil, you can close this issue, and tell Cosmo an example of seed tree.

On Thu, Nov 12, 2015 at 11:23 AM, Linas Vepštas [email protected] wrote:

I meant "do they use moses in a way that makes sense; i.e. do they actually demonstrate something that moses would be good at solving (as opposed to using moses as a fancy random-number generator)"

--linas

On Thu, Nov 12, 2015 at 12:58 AM, Cosmo Harrigan <[email protected]

wrote:

Do these examples even make sense?

@linas https://github.com/linas In what sense? From an abstract point of view, the pole balancing/inverted pendulum problem is a classic benchmark in control theory. But, I don't know about the specifics of how these examples were implemented.

— Reply to this email directly or view it on GitHub https://github.com/opencog/moses/issues/26#issuecomment-155936423.

— Reply to this email directly or view it on GitHub https://github.com/opencog/moses/issues/26#issuecomment-156114616.

ArleyRistar avatar Nov 13 '15 14:11 ArleyRistar

Thanks @arleyristar . Although before closing I think it would be better to fix this example first so that it detects the missing argument and return an informative error message.

ngeiswei avatar Nov 16 '15 06:11 ngeiswei