Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOSES example moses-ann-pole1 segmentation fault #26

Open
cosmoharrigan opened this issue Nov 11, 2015 · 17 comments
Open

MOSES example moses-ann-pole1 segmentation fault #26

cosmoharrigan opened this issue Nov 11, 2015 · 17 comments

Comments

@cosmoharrigan
Copy link
Member

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
Copy link
Member Author

@cosmoharrigan
Copy link
Member Author

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
Copy link
Member Author

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?

@ArleyRistar
Copy link

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 notifications@github.com
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
#26 (comment).

@ArleyRistar
Copy link

ArleyRistar commented Nov 11, 2015 via email

@cosmoharrigan
Copy link
Member Author

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.

@ArleyRistar
Copy link

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 notifications@github.com
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
#26 (comment).

@ArleyRistar
Copy link

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 arley@ristar.me 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 notifications@github.com
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
#26 (comment).

@ngeiswei
Copy link
Member

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.

@cosmoharrigan
Copy link
Member Author

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

@cosmoharrigan
Copy link
Member Author

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

@ngeiswei
Copy link
Member

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.

@linas
Copy link
Member

linas commented Nov 11, 2015

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.

@cosmoharrigan
Copy link
Member Author

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.

@linas
Copy link
Member

linas commented Nov 12, 2015

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 notifications@github.com
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
#26 (comment).

@ArleyRistar
Copy link

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 notifications@github.com
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 <notifications@github.com

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
#26 (comment).


Reply to this email directly or view it on GitHub
#26 (comment).

@ngeiswei
Copy link
Member

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.

ArleyRistar pushed a commit to ArleyRistar/moses that referenced this issue Jan 15, 2016
linas added a commit that referenced this issue Jan 16, 2016
Issue #26: Update ANN examples to give a informative error message.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants