These are chat archives for bluescarni/pagmo_reborn

17th
May 2016
Dario Izzo
@darioizzo
May 17 2016 06:37
API modification proposal: I would like to set get_nobj() to return 1 by default. This means that if not implemented / specified single objective optimization is assumed. If the user forgets to code the method but he is doing multiobjective, an exception will arise when calling the fitness.
Dario Izzo
@darioizzo
May 17 2016 07:21
API modification proposal: the set of methods to extract good/bad individuals is, at the moment:
vector_double::size_type champion(const vector_double &tol) const
vector_double::size_type champion(double &tol) const
I think we should have:
vector_double champion(const vector_double &tol) const
vector_double champion(double &tol) const
vector_double worst(const vector_double &tol) const
vector_double worst(double &tol) const
vector_double::size_type get_best_idx(const vector_double &tol) const
vector_double::size_type get_best_idx(double &tol) const
vector_double::size_type get_worst_idx(const vector_double &tol) const
vector_double::size_type get_worst_idx(double &tol) const
tol defaults to 0. in all cases and would only be relevant for constrained optimization cases.
Dario Izzo
@darioizzo
May 17 2016 07:28

API modification proposal: right now the prototype of evolve is:

population evolve(const population &pop)

which forces us to build a population object inside the evolve. What about

population evolve(population pop)
If accepted the three API modifications above would go in three separate commits before I keep on coding the first algo ....
Marcus Märtens
@CoolRunning
May 17 2016 08:19
Hi!
  1. Maybe we should change champion to best (for consistency?)
  2. I did not get the reason for the last one.
Dario Izzo
@darioizzo
May 17 2016 08:20
there is also a 0. (read above)
Marcus Märtens
@CoolRunning
May 17 2016 08:20
ah - the nobj
Yes, that is fine for me.
Dario Izzo
@darioizzo
May 17 2016 08:21
This message was deleted
Marcus Märtens
@CoolRunning
May 17 2016 08:22
Because we copy the population in evolve anyway?
Dario Izzo
@darioizzo
May 17 2016 08:22
Yes
in evolve we would need anyway to write:
Marcus Märtens
@CoolRunning
May 17 2016 08:22
In place changes of populations are not about to happen?
Because in that case a const ref would be better
Dario Izzo
@darioizzo
May 17 2016 08:23
Let me explain whats my point ....:
If we have a const ref, in order to build the return value we would need to construct a population to copy the input argument
population retval(pop);
This message was deleted
And then work (modify) retval.
If we pass a copy we can directly work on pop ....
Thats it.
Marcus Märtens
@CoolRunning
May 17 2016 08:27
I got this :)
So this is one of the rare cases where giving a (supposedly larger) object by value does make sense. As such this design decision should be documented. Apart from that I agree - better like that.
Dario Izzo
@darioizzo
May 17 2016 08:29
k
Francesco Biscani
@bluescarni
May 17 2016 09:01
if you need to make a copy anyway of the object, pass by value is recommended
but I thought most algorithm would reconstruct a new population from within the evolve method after getting out a vector of individuals or something like this?
my understanding was that the population api would not be used for much else than getting out a list of individuals and creating a popuation from a list of individuals
Dario Izzo
@darioizzo
May 17 2016 09:18
@bluescarni Indeed thats the generic way of doing things. Some algos, though, may benefit to make use of the best_idx, worst_idx methods inside the population, in which case they can operate directly on the pop object.
Francesco Biscani
@bluescarni
May 17 2016 09:19
works for me
Dario Izzo
@darioizzo
May 17 2016 09:19
In both cases the input argument pop must be copied to retain the info on the individual's ID ....
Francesco Biscani
@bluescarni
May 17 2016 09:21
any thought on what I wrote yesterday?
Dario Izzo
@darioizzo
May 17 2016 09:21
On stopping criteria or on boost?
Francesco Biscani
@bluescarni
May 17 2016 09:22
on the python stuff
I am quickly losing patience with pybind
Dario Izzo
@darioizzo
May 17 2016 09:23
Its really your call at this point as you are banging your head against it. The way I see it the advantages of pybind11 are:
1 - many conversions are provided by the library and need not be rewritten
2 - its header only
If these are no longer advantages, then I guess boost can be back ...
Francesco Biscani
@bluescarni
May 17 2016 09:24
so regarding the conversions: it does not matter much because I had anyway to write custom converters to provide an API which speaks NumPy arrays
it's a bit more code to do the numpy conversion from Boost.Python, but I am not much worried about it
Dario Izzo
@darioizzo
May 17 2016 09:26
What is the things that bother you the most in pybind ?
Marcus Märtens
@CoolRunning
May 17 2016 09:26
Is pybind11 part of the C++11?
Francesco Biscani
@bluescarni
May 17 2016 09:26
and regarding the second point: I don't think we have hope to keep a featureful version of PaGMO header only, unless we re-implement a tons of algorithms
so to give you my list of grievenaces:
Dario Izzo
@darioizzo
May 17 2016 09:26
pybind is c++11 but not part of the language @CoolRunning
Francesco Biscani
@bluescarni
May 17 2016 09:27
  • spent an hour working around an inconsistent behaviour (might be a bug, might be not - who knos)
  • smashed my head against serialization issues, uncovering potential undefined behaviour and at least one bug - destructors would not be called on unpickled objects
pybind/pybind11#196
  • after all this the serialization of python-defined problems still does not work, and I have no idea way - it fails on a string conversion due to - I suspect - UTF8 presence in the string
or some bullshit like that
I could keep on opening bugs, but it's tiresome and I don't know if it's worth it
Dario Izzo
@darioizzo
May 17 2016 09:31
I would say lets wait to see if the guy acknowledges the potential UB and the importance of it. He may have a good answer. If he gives signals that he does not care, then we move on?
Francesco Biscani
@bluescarni
May 17 2016 09:32
that does not concern me too much, it's a pybind11 problem after all if it has UB in its internals.. the comment was more in a general code-quality direction
the immediate porblem is that the serialization of python problems does not work
and I have no idea on how to work around it and I spent too much time on it already
Dario Izzo
@darioizzo
May 17 2016 09:33
well then thats a serious issue .... if it cannot be done in pybind11 we need boost
Francesco Biscani
@bluescarni
May 17 2016 09:33
I don't know if it cannot be done, I know I did something similar in Boost Python and as far as I know it was working
Dario Izzo
@darioizzo
May 17 2016 09:33
"cannot be done" = you are done with trying stuff
Francesco Biscani
@bluescarni
May 17 2016 09:34
the thing is that I can try to open a bug, but then I have to explain him what we are trying to do (which is admittedly a bit peculiar) and provide him a minimal working example, because otherwise he does not do anything
and I am afraid of running into other things in the future
I am not convinced in the quality of this library
at least at this time
Dario Izzo
@darioizzo
May 17 2016 09:35
lets go boost. Our awesome CI system should alleviate the burden of depending on the library
we keep cereal?
we will certainly need boost graph ....
Marcus Märtens
@CoolRunning
May 17 2016 09:36
Bummer, but okay - Boost it is I guess?
Francesco Biscani
@bluescarni
May 17 2016 09:36
I won't delete the current bindings, but I want to go the Boost way and see if there are similar problems or not
Dario Izzo
@darioizzo
May 17 2016 09:37
btw not compiling right now correct?
Francesco Biscani
@bluescarni
May 17 2016 09:37
it should work right now
cereal is okish but I discovered there as well things which are not so nice
Dario Izzo
@darioizzo
May 17 2016 09:37
you are a tough reviewer you must admit :)
Francesco Biscani
@bluescarni
May 17 2016 09:37
the json serializer for instance uses an external library which is bundled with cereal
Dario Izzo
@darioizzo
May 17 2016 09:38
and?
Francesco Biscani
@bluescarni
May 17 2016 09:38
and if you make a mistake in the serialization it fails with an assertion
instead of throwing an exception
it crashes and burns the program
this means that if someone sends you a bullshit JSON serialized problem over the network, pagmo will crash without possibility of recovery
at least boost serialization throws exceptions in those cases
I am hoping that the other archives (XML, binary, etc.) are more robust
Francesco Biscani
@bluescarni
May 17 2016 09:43
we cannot build on this bullshit if we ever want to make really pagmo massively parallel
Dario Izzo
@darioizzo
May 17 2016 09:43
I cannot build _core anymore
Do I need to update the submodules?
Francesco Biscani
@bluescarni
May 17 2016 09:44
yes... there were bugs in older versions of pybind11, plus various API changes
Dario Izzo
@darioizzo
May 17 2016 09:44
How is this done? submodule update? I mean properly?
Francesco Biscani
@bluescarni
May 17 2016 09:44
git submodule update does not work?
Dario Izzo
@darioizzo
May 17 2016 09:44
Or I just move to the dir and git pull ?
nope
it does nothing
Francesco Biscani
@bluescarni
May 17 2016 09:46
what kind of error do you get on compilation? and can you post the output of git log?
Dario Izzo
@darioizzo
May 17 2016 09:46
commit fe435c8d3541e543877399ebb86ffc1ad2dca070
Author: Dario Izzo <dario.izzo@gmail.com>
Date:   Tue May 17 11:41:23 2016 +0200

    get_nobj returns now 1 by default and is no longer mandatory to implement

commit 0406f0acd4068bbc6651a9a244e138c2cac3e7e3
Author: Dario Izzo <dario.izzo@gmail.com>
Date:   Tue May 17 10:40:48 2016 +0200

    champion removed for best_idx / worst_idx methods

commit ffed15377167dc1b0779fb873ac45930ce8e4cf1
Author: Dario Izzo <dario.izzo@gmail.com>
Date:   Tue May 17 10:14:10 2016 +0200

    first try for an evolutionary strategy implementation - pending API changes

commit aa672677e555df0e922d89a6fc677369924a226e
Author: Dario Izzo <dario.izzo@gmail.com>
Date:   Tue May 17 10:13:31 2016 +0200

    small changes in comments

commit 774373e9a555e610fa601b3a45644c3bee22bce8
Author: Francesco Biscani <bluescarni@gmail.com>
Date:   Mon May 16 00:36:17 2016 +0200

    pygmo: expose serialization for the exposed concrete C++ problems.

commit 2f6ab3bebe6a01389b6e6543d005d1c0f87be7dd
Author: Francesco Biscani <bluescarni@gmail.com>
Date:   Mon May 16 00:25:15 2016 +0200

    Update pybind11 for bugfix.

commit 3c3589d53f633318e3737551a027d43fbadcb229
Author: Francesco Biscani <bluescarni@gmail.com>
Date:   Sun May 15 20:43:46 2016 +0200

    More work in the exposition of concrete problems.

commit c6d4de67a972626f1c299fa6951e93f8d52ac1bc
Author: Francesco Biscani <bluescarni@gmail.com>
Date:   Sun May 15 14:45:31 2016 +0200

    Start splitting off the Python exposition in separate headers.

commit bdadc83f60cc70407b71f72fe953b45ebb53b7e4
Author: Francesco Biscani <bluescarni@gmail.com>
Date:   Sun May 15 14:33:41 2016 +0200

    Very minor cleanups.

commit 75efe3c96ac08e33d0fda31649f2d8d9571ce786
Author: Francesco Biscani <bluescarni@gmail.com>
Date:   Sun May 15 14:29:06 2016 +0200

    Disable codecov for now.
And the error is a wall of text beginning withL
Francesco Biscani
@bluescarni
May 17 2016 09:47
and if you go into include/external/pybind11 and do a git log what does it show?
Dario Izzo
@darioizzo
May 17 2016 09:47
Scanning dependencies of target _core
[ 97%] Building CXX object pygmo/CMakeFiles/_core.dir/_core.cpp.o
In file included from /home/dario/Documents/PaGMOreborn/pygmo/_core.cpp:26:0:
/home/dario/Documents/PaGMOreborn/pygmo/common_utils.hpp: In function ‘pybind11::object pygmo::deepcopy(pybind11::object)’:
/home/dario/Documents/PaGMOreborn/pygmo/common_utils.hpp:19:82: error: no match for call to ‘(pybind11::object) (pybind11::object&)’
     return static_cast<py::object>(py::module::import("copy").attr("deepcopy"))(o);
                                                                                  ^
/home/dario/Documents/PaGMOreborn/pygmo/common_utils.hpp: In function ‘pybind11::object pygmo::type(pybind11::object)’:
/home/dario/Documents/PaGMOreborn/pygmo/common_utils.hpp:35:61: error: no match for call to ‘(pybind11::object) (pybind11::object&)’
     return static_cast<py::object>(builtin().attr("type"))(o);
                                                             ^
/home/dario/Documents/PaGMOreborn/pygmo/common_utils.hpp: In function ‘pybind11::object pygmo::str(pybind11::object)’:
/home/dario/Documents/PaGMOreborn/pygmo/common_utils.hpp:41:60: error: no match for call to ‘(pybind11::object) (pybind11::object&)’
     return static_cast<py::object>(builtin().attr("str"))(o);
                                                            ^
/home/dario/Documents/PaGMOreborn/pygmo/common_utils.hpp: In function ‘bool pygmo::callable(pybind11::object)’:
/home/dario/Documents/PaGMOreborn/pygmo/common_utils.hpp:50:65: error: no match for call to ‘(pybind11::object) (pybind11::object&)’
     return static_cast<py::object>(builtin().attr("callable"))(o).cast<bool>();
                                                                 ^
/home/dario/Documents/PaGMOreborn/pygmo/common_utils.hpp:50:72: error: expected primary-expression before ‘boolreturn static_cast<py::object>(builtin().attr("callable"))(o).cast<bool>();
                                                                        ^
/home/dario/Documents/PaGMOreborn/pygmo/common_utils.hpp:50:72: error: expected ‘;’ before ‘bool’
/home/dario/Documents/PaGMOreborn/pygmo/common_utils.hpp:50:76: error: expected unqualified-id before ‘>’ token
     return static_cast<py::object>(builtin().attr("callable"))(o).cast<bool>();
                                                                            ^
/home/dario/Documents/PaGMOreborn/pygmo/common_utils.hpp: At global scope:
/home/dario/Documents/PaGMOreborn/pygmo/common_utils.hpp:54:27: error: ‘c_style’ is not a member of ‘pybind11::arrayinline py::array_t<double,py::array::c_style> vd_to_a(const pagmo::vector_double &v)
                           ^
/home/dario/Documents/PaGMOreborn/pygmo/common_utils.hpp:54:27: error: ‘c_style’ is not a member of ‘pybind11::array’
/home/dario/Documents/PaGMOreborn/pygmo/common_utils.hpp:54:45: error: wrong number of template arguments (2, should be 1)
 inline py::array_t<double,py::array::c_style> vd_to_a(const pagmo::vector_double &v)
                                             ^
In file included from /home/dario/Documents/PaGMOreborn/pygmo/pybind11.hpp:16:0,
                 from /home/dario/Documents/PaGMOreborn/pygmo/common_utils.hpp:9,
                 from /home/dario/Documents/PaGMOreborn/pygmo/_core.cpp:26:
/home/dario/Documents/PaGMOreborn/pygmo/../include/external/pybind11/include/pybind11/numpy.h:123:29: note: provided fortemplate<class T> class pybind11::array_t’
 template <typename T> class array_t : public array {
                             ^
In file included from /home/dario/Documents/PaGMOreborn/pygmo/_core.cpp:26:0:
/home/dario/Documents/PaGMOreborn/pygmo/common_utils.hpp: In function ‘int pygmo::vd_to_a(const vector_double&)’:
/home/dario/Documents/PaGMOreborn/pygmo/common_utils.hpp:56:31: error: ‘c_style’ is not a member of ‘pybind11::arrayreturn py::array_t<double,py::array::c_style>(py::buffer_info(
                               ^
/home/dario/Documents/PaGMOreborn/pygmo/common_utils.hpp:56:31: error: ‘c_style’ is not a member of ‘pybind11
commit 9e75905b697793b921e0f188669a47d299620ba5
Author: Wenzel Jakob <wenzel.jakob@epfl.ch>
Date:   Thu Mar 31 14:22:37 2016 +0200

    fix testcase issue on windows related to unicode encoding

commit b90e68de7e839ba9953483c6a13a9d0e945420e1
Author: Wenzel Jakob <wenzel.jakob@epfl.ch>
Date:   Sun Mar 27 00:19:32 2016 +0100

    another corner case (fixes #151)

commit 08927e9809e1bd15629bf3bbf819a3e9cb1fd59a
Author: Wenzel Jakob <wenzel.jakob@epfl.ch>
Date:   Sat Mar 26 23:38:46 2016 +0100

    tabs->spaces

commit 9883ec01d7bfb87a90e75032581efbef906c6bcb
Author: Wenzel Jakob <wenzel.jakob@epfl.ch>
Date:   Sat Mar 26 23:37:51 2016 +0100

    allow nullptr string values (closes #138)

commit 7393343f6935c71026eeabc3e21d893af25587f4
Author: Wenzel Jakob <wenzel.jakob@epfl.ch>
Date:   Sat Mar 26 23:04:40 2016 +0100

    removed unnecessary code

commit d3349af48b0ffa101660b370bc702454fd064968
Author: Wenzel Jakob <wenzel.jakob@epfl.ch>
Date:   Sat Mar 26 23:04:10 2016 +0100

    modularized logic in preceding change, fixed issue with char (fixes #150)

commit 0772967ecfbc3c1cf6260bbc5277c7a2b801cec7
Author: Wenzel Jakob <wenzel.jakob@epfl.ch>
Date:   Sat Mar 26 20:41:28 2016 +0100

    allow nullptr when passing void* values
Francesco Biscani
@bluescarni
May 17 2016 09:48
I just did a git pull on my laptop and it updated the submodule as well
ah wait no
let me try to solve this here, I have the same behaviour :)
Dario Izzo
@darioizzo
May 17 2016 09:49
k
Francesco Biscani
@bluescarni
May 17 2016 10:01
can you try a submodule update now?
maybe we should switch to subtrees, this submodule stuff is horrid
I mean we are already using subtrees for the cmake stuff and it works much better
actually... I am gonna go ahead an do it
fuck this shit
Francesco Biscani
@bluescarni
May 17 2016 10:07
holy fuck it's painful to try new things isn't it :)
Dario Izzo
@darioizzo
May 17 2016 10:07
back
internet blackout :)
so should I try anything or wait?
Francesco Biscani
@bluescarni
May 17 2016 10:08
give it a go, just for kicks :)
Dario Izzo
@darioizzo
May 17 2016 10:10
works and build
template <typename T>
class has_evolve: detail::sfinae_types
{
        template <typename U>
        static auto test0(const U &p) -> decltype(p.evolve(std::declval<population>()));
        static no test0(...);
        static const bool implementation_defined =
            std::is_same<population,decltype(test0(std::declval<const T &>()))>::value;
    public:
        /// static const boolean value flag
        static const bool value = implementation_defined;
};
whats wrong in this? it fails on:
struct hev_01
{
    population evolve(population) const;
};
BOOST_CHECK(has_evolve<hev_01>::value)
fails
Francesco Biscani
@bluescarni
May 17 2016 10:14
doesn't fail here
#include <iostream>
#include <type_traits>

struct population {};

template <typename T>
class has_evolve
{
        struct no {};
        template <typename U>
        static auto test0(const U &p) -> decltype(p.evolve(std::declval<population>()));
        static no test0(...);
        static const bool implementation_defined =
            std::is_same<population,decltype(test0(std::declval<const T &>()))>::value;
    public:
        /// static const boolean value flag
        static const bool value = implementation_defined;
};

struct hev_01
{
    population evolve(population) const;
};

int main()
{
        std::cout << has_evolve<hev_01>::value << '\n';
}
this prints 1 to me
maybe population is missing some constructors?
Dario Izzo
@darioizzo
May 17 2016 10:15
?
Francesco Biscani
@bluescarni
May 17 2016 10:16
declval<population>() declares an rvalue reference to population, which is then used to move-initialise the population argument to evolve()
does population have a move constructor?
Dario Izzo
@darioizzo
May 17 2016 10:17
defaulted
Francesco Biscani
@bluescarni
May 17 2016 10:17
looks like it has it yeah
Dario Izzo
@darioizzo
May 17 2016 10:17
can I commit the broken test ?
may be a stupid typo I cannot see somewhere
Francesco Biscani
@bluescarni
May 17 2016 10:17
does the code above works for you?
Dario Izzo
@darioizzo
May 17 2016 10:18
yes
1
its the same code that fails in the test !!???
Francesco Biscani
@bluescarni
May 17 2016 10:19
there must be something fishy in the population class
try to commit it
Dario Izzo
@darioizzo
May 17 2016 10:20
done
Francesco Biscani
@bluescarni
May 17 2016 10:21
which test is supposed to fail?
algorithm?
Dario Izzo
@darioizzo
May 17 2016 10:22
type trait
Francesco Biscani
@bluescarni
May 17 2016 10:23
you are not including the population header are you?
Dario Izzo
@darioizzo
May 17 2016 10:24
only the fwd
Francesco Biscani
@bluescarni
May 17 2016 10:24
it cannot know that the population has an evolve() method only from the fwd declaration, can it
wait sorry
I meant to say another thing :)
so whenever you use a class in a non-template context (roughly speaking), you need to have a full definition of it
so it should be fine to have only the fwd included in the type_traits.hpp
because the only use you make there is in a template class, which is not instantiated immediately but only when actually used somewhere
Dario Izzo
@darioizzo
May 17 2016 10:27
it worked before, plus evolve is a method of algorithm not of population
population is only used as a type
Francesco Biscani
@bluescarni
May 17 2016 10:27
if you use it in type_traits.cpp you have to include it there, it's even in our guidelines
Dario Izzo
@darioizzo
May 17 2016 10:27
does the test fail n your setup?
Francesco Biscani
@bluescarni
May 17 2016 10:28
I fixed it with the additional include in the cpp
it worked before because if you are passing a reference to an object you don't need to know anything about that object
now that you pass by copy you need to know if that object has a copy constructor
and the fwd declaration is not enough for that
Dario Izzo
@darioizzo
May 17 2016 10:29
so I have to inlcude population.hpp not the fwd
k
Francesco Biscani
@bluescarni
May 17 2016 10:30
you have to be careful about circular includes, if you are in a situation where you are unsure it would be better to split if off in a separate include
like if population.hpp ends up including type_traits.hpp for some reason
Dario Izzo
@darioizzo
May 17 2016 10:31
k thanks
Francesco Biscani
@bluescarni
May 17 2016 10:31
we have to be careful about this, probably the split header would be better because otherwise the type trait fails if one does not include population.hpp together with it
need to think about it
Dario Izzo
@darioizzo
May 17 2016 10:32
Wait, I am not following. There is not circular problem if I add population.hpp to the test cpp file
Francesco Biscani
@bluescarni
May 17 2016 10:32
we don't want to have these constraints on how we include this
the problem is: is the inclusion of type_traits.hpp enough to make sure the type trait has_evolve works?
apparently it's not
Dario Izzo
@darioizzo
May 17 2016 10:33
right
we need population hence the circular bullshit
Francesco Biscani
@bluescarni
May 17 2016 10:33
can you include population.hpp from type_traits or does this give problems?
type_traits.hpp
Dario Izzo
@darioizzo
May 17 2016 10:33
no not possible
we made the fwd for that reason
Francesco Biscani
@bluescarni
May 17 2016 10:34
so the solution in this case is to have a separate header
has_evolve.hpp -> which includes population.hpp
Dario Izzo
@darioizzo
May 17 2016 10:34
brutto
Francesco Biscani
@bluescarni
May 17 2016 10:35
the alternative is to have the type traits failing randomly depending on the inclusion order
Dario Izzo
@darioizzo
May 17 2016 10:35
meglio
chaos knight!!
committo the working code
Francesco Biscani
@bluescarni
May 17 2016 10:36
or you can put the type trait in population.hpp
so you are sure the definition of population is always included
or in algorithm.hpp
which also needs the population definition anyway
Dario Izzo
@darioizzo
May 17 2016 10:38
which type trait would you include in population?
you mean to put has evolve type trait in algorithm?
Francesco Biscani
@bluescarni
May 17 2016 10:38
none... I would put has_evolve in algorithm on second thought, or its separate header
yes
separate header works as well
Dario Izzo
@darioizzo
May 17 2016 10:39
I would prefer algorithm
makes more sense and does not pollute the root folder
Francesco Biscani
@bluescarni
May 17 2016 10:39
it would make sense to put the type traits referring to algorithms and problems together with the algorithm and problem classes
for the pollution: we gonna have pagmo.hpp anyway and just put that in the C++ tutorials :p
Dario Izzo
@darioizzo
May 17 2016 10:42
For the moment I movet the algo type traits into algorithm ...
Francesco Biscani
@bluescarni
May 17 2016 10:44
ok
Dario Izzo
@darioizzo
May 17 2016 10:48
what about splitting type traits into type_traits_problem.hpp type_traits_algorithm.hpp
At least we can maintain some logic in the test and not have type traits tested in a random test file
Francesco Biscani
@bluescarni
May 17 2016 11:02
but the problem.hpp ends up including the type traits in any case no?
I mean, you need them to be available when you test them in the generic problem
Dario Izzo
@darioizzo
May 17 2016 11:04
gia' ...
Francesco Biscani
@bluescarni
May 17 2016 11:05
realistically I think we should have some catch-all headers like core.hpp, which includes all the core classes, plus things like algorithms.hpp to include all algorithms, and the same for problems.. and than maybe pagmo.hpp which includes everything
Dario Izzo
@darioizzo
May 17 2016 11:06
Does this not imply longer compilation times for the user?
Francesco Biscani
@bluescarni
May 17 2016 11:09
it depends what is the user case... if the user implements a problem for instance, he's gonna need to include all the other stuff to run the optimisation as well
it's not like he can get away only with problem.hpp
since pagmo is header only now he will still have to include all the code for the core classes
but on the upshot you only have to compile a single file, without linking etc.
it performs better as well, as the compiler "sees" all the code at once... for instance I think it can easily inline and devirtualize all the virtual function calls, because we marked them final and all their definitions are visible at compile time
Francesco Biscani
@bluescarni
May 17 2016 12:35
const auto &dim = prob.get_nx(); you are aware why this works?
@darioizzo
Francesco Biscani
@bluescarni
May 17 2016 12:57
Marcus Märtens
@CoolRunning
May 17 2016 13:39
:worried:
Dario Izzo
@darioizzo
May 17 2016 14:56
Hey
prob.get_nx() returns a const ref to m_nx. I guess dim becomes that const ref no?
Francesco Biscani
@bluescarni
May 17 2016 14:57
it returns a copy
Dario Izzo
@darioizzo
May 17 2016 14:57
same
Francesco Biscani
@bluescarni
May 17 2016 14:58
you are taking a reference to a temporary value
it just works because of a special rule in the standard which extends the lifetime of const references
but it would crash with a non-const reference
Dario Izzo
@darioizzo
May 17 2016 14:59
wait let me get this ...
Francesco Biscani
@bluescarni
May 17 2016 14:59
I need to go to grab the train
Dario Izzo
@darioizzo
May 17 2016 14:59
ok later