These are chat archives for bluescarni/pagmo_reborn

7th
May 2016
Francesco Biscani
@bluescarni
May 07 2016 10:14
@darioizzo you around?
Dario Izzo
@darioizzo
May 07 2016 12:26
Appena tornato dall aeroporto
Francesco Biscani
@bluescarni
May 07 2016 12:36
poi con calma alcune domande
Dario Izzo
@darioizzo
May 07 2016 13:23
dopo allora ora le bimbe mi stanno assalendo e non mi lasciano far altro ma giocare con loro dodfqwnfewqfivdadsvds vdsvsda
appunrwqoifweqoijfqwe
to
:)
Francesco Biscani
@bluescarni
May 07 2016 13:23
mamma e papa'?
ciao vale ciao virginia!
Dario Izzo
@darioizzo
May 07 2016 13:28
ciaooo
Francesco Biscani
@bluescarni
May 07 2016 15:06
it's really weird.. but after changing roughly 80% of the problem class without ever compiling it midway, it compiled at the first try and passed most tests :)
now I've added a couple of fixes and all tests pass
Marcus Märtens
@CoolRunning
May 07 2016 15:31
That seems very surreal...
Francesco Biscani
@bluescarni
May 07 2016 15:33
it is, I am still afraid I fucked up real bad and just not realising :)
Marcus Märtens
@CoolRunning
May 07 2016 15:36
Why did it need to be rewritten so much?
Francesco Biscani
@bluescarni
May 07 2016 15:39
to increase the safety of its use mainly
Marcus Märtens
@CoolRunning
May 07 2016 15:40
The consistency thing you talked about last time?
Francesco Biscani
@bluescarni
May 07 2016 15:40
no that's another thing, a bit connected
basically the goal is that no matter how much of a shitty problem gets implemented by the user, pagmo code should never crash
Dario Izzo
@darioizzo
May 07 2016 15:41
I am not surprised .... you ARE clang .... Francesco Clang Biscani ....
Francesco Biscani
@bluescarni
May 07 2016 15:42
I spend too much time worrying about bullshit that does not matter, and that's the result
Marcus Märtens
@CoolRunning
May 07 2016 15:43
:+1:
Francesco Biscani
@bluescarni
May 07 2016 16:10
I think I just realised my son understands resonances
he knows exactly when to push when swinging to maximise the amplitude
Marcus Märtens
@CoolRunning
May 07 2016 16:12
:)
Dario Izzo
@darioizzo
May 07 2016 16:14
auto bounds = ptr()->get_bounds();
where is ptr coming from?
line 500 and following of the last problem.hpp
Dario Izzo
@darioizzo
May 07 2016 16:20
right its a private method asserting m_ptr is not null.
Francesco Biscani
@bluescarni
May 07 2016 16:21
yeah
I'll be afk for a while, catch you later
Marcus Märtens
@CoolRunning
May 07 2016 16:40
Lets see if this still compiles.
Marcus Märtens
@CoolRunning
May 07 2016 16:49
It actually does.
Dario Izzo
@darioizzo
May 07 2016 17:32
in _core.cpp, lines 181, 208:
return dense_gradient(f_dim, dim);
But dense_gradient is a private static member of problem .... is this ok?
Francesco Biscani
@bluescarni
May 07 2016 17:35
sure why not?
Francesco Biscani
@bluescarni
May 07 2016 17:40
I don't understand why on population 194 there's a call to std::distance.. shouldn't be enough there to return the value of the index?
Marcus Märtens
@CoolRunning
May 07 2016 17:40
@darioizzo Let's bring back the hypervolume! Are you okay with having a hypervolume.hpp in include/utils where I can start messing things up?
Dario Izzo
@darioizzo
May 07 2016 18:04
@CoolRunning Ok
@bluescarni:
I get the following error in compilation: /Users/darioizzo/Documents/PaGMOreborn/pygmo/_core.cpp:208:16: error: use of undeclared identifier 'dense_hessians'
return dense_hessians(f_dim, dim);
so i thought its a problem of namespace resolution since we are there inside detail
si i modified it to pagmo::problem::dense_hessian, and then I got:
error: 'dense_gradient' is a private member of 'pagmo::problem'
return pagmo::problem::dense_gradient(f_dim, dim);
Marcus Märtens
@CoolRunning
May 07 2016 18:06
Okay - I will have a look at multi_objective.hpp for details about how you included that and write some mock hypervolume header.
Dario Izzo
@darioizzo
May 07 2016 18:07
good idea ... even though there is not much to learn from multi_objective.hpp :)
Francesco Biscani
@bluescarni
May 07 2016 18:07
but the CI passes and it passes here as well?
Dario Izzo
@darioizzo
May 07 2016 18:07
I am on osx
Francesco Biscani
@bluescarni
May 07 2016 18:07
ahhh ok core
Dario Izzo
@darioizzo
May 07 2016 18:08
and am compiling _core
yes
Francesco Biscani
@bluescarni
May 07 2016 18:08
that probably did not work before either :)
Dario Izzo
@darioizzo
May 07 2016 18:08
I think I compiled it a few days ago ... I was on this machine
but I am not sure
Francesco Biscani
@bluescarni
May 07 2016 18:09
right ok, it may have compiled but it did not keep up with the modfications in problem we did over the last couple of weeks
waiting for problem to stabilize before touching it again
Dario Izzo
@darioizzo
May 07 2016 18:09
k
the rest seems ok ... definitely an improvement in the logic and warranties offered
Francesco Biscani
@bluescarni
May 07 2016 18:10
Did you take a look at population:194?
Dario Izzo
@darioizzo
May 07 2016 18:10
Yes ...
so you want to return *idx right?
Francesco Biscani
@bluescarni
May 07 2016 18:12
yes if I've understood correctly what it does
Dario Izzo
@darioizzo
May 07 2016 18:12
Indeed it should be the same value as the sdt::distance call and more "clear" ... so its ok
Francesco Biscani
@bluescarni
May 07 2016 18:12
it is also unsigned vs signed :)
Dario Izzo
@darioizzo
May 07 2016 18:13
true!!! then its definitely a go :)
@CoolRunning Note that while in PaGMO legacy we were using structures such as the individual and population in the prototypes for stuff like Pareto Front etc., in PaGMOreborn we want to maintain "ortogonality" between algorithms and their use in our classes.
As a consequence you will note that, for example, fast_non_dominated_sorting accept a std::vector<vector_double> (i.e. a collection of points) as input.
In the PaGMOreborn, it would have operated directly on a population.
Keep the same logic for the hypervolumes.
Its now easy from a pop to extract the chromosomes as population.get_x()
returns a std::vector<vector_double>
Marcus Märtens
@CoolRunning
May 07 2016 18:16
The old hypervolume did not need populations or individuals... it worked on "fitness_vectors" purely. In this case, it will work on vectors.
what is vector_double exactly?
Dario Izzo
@darioizzo
May 07 2016 18:17
std::vector<double>
just a renaming
Marcus Märtens
@CoolRunning
May 07 2016 18:17
okay, so this is for nesting
Dario Izzo
@darioizzo
May 07 2016 18:17
Yes I remember the hypervolume decision, which now turns out to be mainstream .. :)
Marcus Märtens
@CoolRunning
May 07 2016 18:18
question: is this valid?
std::vector<vector_double> spam = { {1,2,3}, {4,5,6}};
Dario Izzo
@darioizzo
May 07 2016 18:18
it is now yes!
cool huh?
Marcus Märtens
@CoolRunning
May 07 2016 18:18
I need to get used to the initialization list syntax
Dario Izzo
@darioizzo
May 07 2016 18:18
better even std::vector<vector_double> spam{ {1,2,3}, {4,5,6}};
As you call the initializer list constructor.
Marcus Märtens
@CoolRunning
May 07 2016 18:19
I see
Dario Izzo
@darioizzo
May 07 2016 18:19
in c++11 you can accept as argument a std::initializer_list type in your constructors, which enable things like the above
Marcus Märtens
@CoolRunning
May 07 2016 18:20
Sort of hard to believe he knows what to do when he encounters the line you wrote :)
But its cool, I like.
next question: where are all the classes?
I have only seen structs so far?
Dario Izzo
@darioizzo
May 07 2016 18:21
A struct is a class in c++ the only difference is that struct -> by default all is public, class -> by default all is private
Marcus Märtens
@CoolRunning
May 07 2016 18:22
I know - but is there a reason why so far everything was designed with structs?
Dario Izzo
@darioizzo
May 07 2016 18:22
But population is a class and so is problem
Marcus Märtens
@CoolRunning
May 07 2016 18:22
ah - okay
Dario Izzo
@darioizzo
May 07 2016 18:22
the user can write his problem as a struct, class whatever makes him happy
Marcus Märtens
@CoolRunning
May 07 2016 18:22
Because hypervolume will be a class
Dario Izzo
@darioizzo
May 07 2016 18:23
fair ... as I said the different is only in the default being private
brb
Marcus Märtens
@CoolRunning
May 07 2016 18:23
Okay, fair enough.
Dario Izzo
@darioizzo
May 07 2016 18:35
On your question: what happens when I write: T spam{{1,2,3}, {4,5,6}};
I think what happens is that the compiler goes in the class T and looks for a constructor with signature T(std::initializer_list l), if he finds it, then it calls it. If he does not find it, then the uniform initialization syntax is valid and he basically interprets it as T spam({1,2,3}, {4,5,6})
Marcus Märtens
@CoolRunning
May 07 2016 18:46
Question: the .hpp-files are not compiled, right? So there is no point in having a CMakeLists around. If I want to check my code in the hypervolume.hpp I have to include this header somewhere in a .cpp and see that this compiles, correct?
And follow-up question: I already started writing unit-tests for hypervolumes. Do I need to include my hypervolume-test.cpp somewhere to be found?
Ah... I see there is a CMakelist in ./tests
Ah, I managed. That works.
Marcus Märtens
@CoolRunning
May 07 2016 18:56
New question: How do I write a test in BOOST that will tell me, if my object was constructed correctly?
More precisely: auto hv = hypervolume({{1,2},{3,4}}); should give me a hypervolume-object with the coordinates saved inside. What is the proper way of checking it did so?
Francesco Biscani
@bluescarni
May 07 2016 19:06
can you check the properties after construction? like BOOST_CHECK(hv.size() == ...
Marcus Märtens
@CoolRunning
May 07 2016 19:07
yes
Francesco Biscani
@bluescarni
May 07 2016 19:07
you don't have to add the headers to any CMake at the moment... eventually we want to have them installed when one does make install though, so we will have to add them
Marcus Märtens
@CoolRunning
May 07 2016 19:08
So I basically construct and afterwards check the value of the members?
Francesco Biscani
@bluescarni
May 07 2016 19:08
yeps
I need to go to put Ben to sleep
be back in a while
Marcus Märtens
@CoolRunning
May 07 2016 19:12
I get some weird messages now when I build "RUN_TESTS"
In fact, the tests are running (the hypervolume test fails intentionally) but then it complains
1>  Errors while running CTest
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(133,5): error MSB3073: The command "setlocal
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(133,5): error MSB3073: "C:\Program Files (x86)\CMake\bin\ctest.exe" --force-new-ctest-process -C Debug
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(133,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(133,5): error MSB3073: :cmEnd
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(133,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(133,5): error MSB3073: :cmErrorLevel
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(133,5): error MSB3073: exit /b %1
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(133,5): error MSB3073: :cmDone
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(133,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(133,5): error MSB3073: :VCEnd" exited with code 8.
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
Francesco Biscani
@bluescarni
May 07 2016 19:36
that looks like something MSVC specific
does it give messages when the tests run ok?
Marcus Märtens
@CoolRunning
May 07 2016 19:37
No, only if one fails.
Francesco Biscani
@bluescarni
May 07 2016 19:38
right.. well I think you can run cmake also from outside visual studio... I mean for the building and testing part
I am setting up a Windows 10 VM right now
maybe I can help a bit
basically you just use MSVC as an editor, then you run commands from the console to compile and test
Marcus Märtens
@CoolRunning
May 07 2016 19:39
I'd be fine with that
Hypervolumes were one of the more thoroughly tested features in the old PaGMO. I am thinking about whether I should bring over all the test-cases first and fix them one-by-one.
Francesco Biscani
@bluescarni
May 07 2016 19:41
is the Hypervolume code self-contained?
Marcus Märtens
@CoolRunning
May 07 2016 19:41
What do you mean by that exactly?
Francesco Biscani
@bluescarni
May 07 2016 19:41
how much does it depend on other pagmo pieces?
Marcus Märtens
@CoolRunning
May 07 2016 19:42
Almost nothing. It uses fitness_vector as a base datastructure for maintaining information about coordinates. But thats it.
Francesco Biscani
@bluescarni
May 07 2016 19:43
well then I imagine you could import the code into the new pagmo, make sure that the test cases pass, and then we can start fixing the pointer stuff
Marcus Märtens
@CoolRunning
May 07 2016 19:43
Old code also used "pagmo_throw" for when things went wrong.
I also expect that it is mostly copy&paste
There is the hypervolume class which interfaces with pagmo, but the actual algorithms are independent. Some of them are actually just wrapped 3rd party code.
Francesco Biscani
@bluescarni
May 07 2016 19:46
yep.. copy paste should be fine at the beginning
Marcus Märtens
@CoolRunning
May 07 2016 19:47
You don't want pointers anymore, right?
The old hypervolume2d computation had this sort of signature: double hv2d::compute(double** points, unsigned int n_points, double* r_point) const
But I guess this is no longer wanted?
Francesco Biscani
@bluescarni
May 07 2016 19:50
I'd need to understand exactly... but in general pointers are fine when you are passing them into functions and things like these
the problem is when you have to call new and delete manually
those two keywords should never (or almost never :) ) appear in a C++11 codebase
Marcus Märtens
@CoolRunning
May 07 2016 19:51
They happened in the old code.
But this is probably not of concern right now.
I need a way of having tests run a bit better. The current way is a bit limiting...
Francesco Biscani
@bluescarni
May 07 2016 19:52

that is what I wanted to change.. so basically the main pattern is from

double *ptr = new ...;
/// stuf stuff
delete ptr;

to

auto ptr = std::make_unique<double>(...);
Marcus Märtens
@CoolRunning
May 07 2016 19:53
"make_unique"?
Francesco Biscani
@bluescarni
May 07 2016 19:53
make_unique creates an std::unique_ptr that takes care of deallocating the storage when it is destroyed
Marcus Märtens
@CoolRunning
May 07 2016 19:53
so as soon as ptr falls out of scope, it deallocates?
yes exactly
but you can also return it from functions, as it is move aware
so if you do:
std::unique_ptr<double> foo()
{
    auto retval = std::make_unique<...;
    return retval;
}
this will work as expected
you can also store it in vectors, etc.
Marcus Märtens
@CoolRunning
May 07 2016 19:55
smart
Francesco Biscani
@bluescarni
May 07 2016 19:55
most importantly, it deallocates and cleans up also in face of exceptions
Marcus Märtens
@CoolRunning
May 07 2016 19:55
I have no clue about exceptions in C++ :smile:
Francesco Biscani
@bluescarni
May 07 2016 19:56
look at this:
double *ptr = new ...;
// stuff
// stuff
delete ptr;
Marcus Märtens
@CoolRunning
May 07 2016 19:56
Usually, if something goes wrong with my C++code, the whole thing just burns... :fire:
Francesco Biscani
@bluescarni
May 07 2016 19:56
if in stuff an exception is thrown, you never reach the delete and you leak memory
Marcus Märtens
@CoolRunning
May 07 2016 19:56
true
Francesco Biscani
@bluescarni
May 07 2016 19:56
but if you use a unique_ptr, then its destructor gets called as part of the exception unwinding
so it cleans up everything
Marcus Märtens
@CoolRunning
May 07 2016 19:57
Seems like this pointer is really obsessed with cleaning up.
Francesco Biscani
@bluescarni
May 07 2016 19:58
crash and burn it's kinda ok if you are running thing in batch mode, but in interactive mode (e.g. from Python) it's a big no no
Marcus Märtens
@CoolRunning
May 07 2016 19:58
Of course :)
But using this pointer will come later... first I need these tests. It is inconvenient, that the actual testrunner seems a bit tongue-tied. I could copy all the tests in my ./tests/hypervolume.cpp, but if only one of it fails, the whole thing will fail and it seems it does not tell me why by default?
Francesco Biscani
@bluescarni
May 07 2016 20:01
how was the testing done previously?
Marcus Märtens
@CoolRunning
May 07 2016 20:02
Home-made... there is a main-function which does some file-I/O
I guess this was built and called by "make test"
However, this was not for the interface
but rather for the algorithms (if they computed the correct values)
The interface itself was only tested on the Python-level
it seems
Francesco Biscani
@bluescarni
May 07 2016 20:06
https://github.com/esa/pagmo/blob/master/tests/hypervolume_test.cpp this is it or is there more? (apart from the test data)
Marcus Märtens
@CoolRunning
May 07 2016 20:06
With import unittest in Python
Francesco Biscani
@bluescarni
May 07 2016 20:06
ah so the test suite could be run only from Python?
Marcus Märtens
@CoolRunning
May 07 2016 20:06
This is the test-runner for the numerics of the actual algorithms.
The test suite for the interface was only in Python it seems
I need to rewrite this one into the BOOST unittest framework
Francesco Biscani
@bluescarni
May 07 2016 20:08
sounds good.... you should do it piece by piece starting with the easiest bits
we can and we will have Python tests, but the idea would be that the core of PaGMO is fully tested on the C++ side, and on Python I'd rather test the glue between the two languages rather that core functionality
Marcus Märtens
@CoolRunning
May 07 2016 20:09
Adding one by one would at least eliminate the question, which one failed.
I agree. We need C++ tests.
Apart from the weird error at the end, it also works. I will just start and see what issues pop up.
Francesco Biscani
@bluescarni
May 07 2016 20:12
goddamn I gave 30GB of space to the VM and it's already gone before I even finish downloading boost
holy crap
Marcus Märtens
@CoolRunning
May 07 2016 20:13
:smile:
Francesco Biscani
@bluescarni
May 07 2016 20:13
MSVC only took 10GB
10GB for a friggin compiler
Marcus Märtens
@CoolRunning
May 07 2016 20:13
let me see how much Win is using on my box
My Windows-folder alone is 21GB
With box I mean my native windows machine ^^
Francesco Biscani
@bluescarni
May 07 2016 20:15
ok I am restarting with 60GB
sigh
another few hours to install windows, MSVC, .....
let's make it 70
it's not even that bad so far windows 10... any tips tomake it more lightweight? the idiotic metro thing, me no likes
Marcus Märtens
@CoolRunning
May 07 2016 20:18
The only thing is not to use the standard default installation, but deactivate all the crap and smart functions that gonna spy on you
But to make it more lightweight? No idea... this machine here was once a WinXP that got upgraded to Win7 and now reached Win10. I can't possible imagine how many crap that whole procedure left behind.
Actually - tell me how big your Win10 folder is afterwards - I am curious.
Marcus Märtens
@CoolRunning
May 07 2016 20:20
Ah, actually not true. Since I switched at some point to SSD I made a clean install of Win7
Francesco Biscani
@bluescarni
May 07 2016 20:20
reminds me of when I was a teenager and would buy all those crappy CDs from the newspaper stand with the registry cleaning utils etc.
Marcus Märtens
@CoolRunning
May 07 2016 20:20
And since Metro sucked hard, I never did the Win8 thing
My registry shall never be touched by any "freeware" cleaning programs out of the interwebz :smile:
It's just not the idea behind Windows to make it nice and lightweight like some Linux OS
You can still do some performance tweaking manually though
But I compensate with fat hardware, so I never feel the need to make it even more faster
Francesco Biscani
@bluescarni
May 07 2016 20:23
the app store opening in the start menu gets on my nerve
Marcus Märtens
@CoolRunning
May 07 2016 20:23
I.e. I would rather tweak my hardware than optimizing Windows
Francesco Biscani
@bluescarni
May 07 2016 20:23
and bing is fucking awful
Marcus Märtens
@CoolRunning
May 07 2016 20:23
Bing sucks, I agree
I just realized, I made Kiryx test for all sorts of shit...
I wonder, do we need to test what happens if someone constructs a hypervolume object by giving a string as a parameter?
(which obviously is not how you would initialize the thing)
Francesco Biscani
@bluescarni
May 07 2016 20:25
you don't need to test for that from c++
Marcus Märtens
@CoolRunning
May 07 2016 20:27
Actually, we don't need a default constructor for hypervolume... empty hypervolumes do not make sense. Life is becoming easier by the minute...
Or do we need that for serialization?
Dario Izzo
@darioizzo
May 07 2016 20:31
Indeed. A default constructor is called by serialization befor assigning all its members
Francesco Biscani
@bluescarni
May 07 2016 20:31
it would help for serialization yes... but are hypervolumes something you store in a class or something that you just generate on the fly and then discard?
Dario Izzo
@darioizzo
May 07 2016 20:31
But it can be anything, also something that does not make sense
@bluescarni We want the possibility of doing both things
Francesco Biscani
@bluescarni
May 07 2016 20:32
yes then it would help
@darioizzo does the champion() code cope with empty pops?
Dario Izzo
@darioizzo
May 07 2016 20:32
rethoric question you already know the answer to?
Francesco Biscani
@bluescarni
May 07 2016 20:33
:) just wondering if I am missing something
Dario Izzo
@darioizzo
May 07 2016 20:33
i will have a look, but i am sure you saw right
Marcus Märtens
@CoolRunning
May 07 2016 20:35
Okay, default constructor is no problem
I need to throw some exceptions
Dario Izzo
@darioizzo
May 07 2016 20:35
As it is it would throw invalid argument for unconstrained case and NS (not sure) for unconstrained. Lets add an explicit check
Marcus Märtens
@CoolRunning
May 07 2016 20:35
I see you do something like pagmo_throw(std::invalid_argument,"A fitness vector of size ...
Are there different types than std::invalid_argument? Or can I use this one just for everything?
But for wrong argument types, which is 90% of what we throw, we are using std::invalid_argument
Marcus Märtens
@CoolRunning
May 07 2016 20:40
I see
Francesco Biscani
@bluescarni
May 07 2016 20:41
it seems like it would UB here return sort_population_con(m_f, m_prob.get_nec(), tol)[0]; and return something wrong here return static_cast<vector_double::size_type>(std::distance(indexes.begin(), idx));
I just added a check at the beginning
Dario Izzo
@darioizzo
May 07 2016 20:41
k great!
Francesco Biscani
@bluescarni
May 07 2016 20:44
qemu is working like shit, it looks like I might have to go virtualbox.. sigh
Dario Izzo
@darioizzo
May 07 2016 20:44
virtualbox works great .. why you do not like it?
Marcus Märtens
@CoolRunning
May 07 2016 20:44
I am refactoring some code... could you tell me whether this is correct C++11 shit?
old code:
std::vector<double>::size_type f_dim = m_points[0].size();
        if (f_dim <= 1) {
            pagmo_throw(std::invalid_argument, "Points of dimension > 1 required.");
        }
        for (std::vector<double>::size_type idx = 1; idx < m_points.size(); ++idx) {
            if (m_points[idx].size() != f_dim) {
                pagmo_throw(std::invalid_argument, "All point set dimensions must be equal.");
            }
        }
new code:
```
Francesco Biscani
@bluescarni
May 07 2016 20:45
because it requires modules outside the standard kernel tree and because Oracle is running Virtualbox into the ground as they did with mysql, Java, etc.
:/
Marcus Märtens
@CoolRunning
May 07 2016 20:45
new code:
        auto f_dim = m_points[0].size();
        if (f_dim <= 1) {
        pagmo_throw(std::invalid_argument, "Points of dimension > 1 required.");
        }
        for (auto &v : m_points) {
            if (v.size() != f_dim) {
            pagmo_throw(std::invalid_argument, "All point set dimensions must be equal.");
        }
did I get this right?
Dario Izzo
@darioizzo
May 07 2016 20:46
also for(const auto &v : m_points) ... I think its more correct
Francesco Biscani
@bluescarni
May 07 2016 20:46
it's correct, even better would be with const.. as dario says
Marcus Märtens
@CoolRunning
May 07 2016 20:47
sure, I do not change v
Dario Izzo
@darioizzo
May 07 2016 20:47
Marcus Märtens
@CoolRunning
May 07 2016 20:47
This looks so much better... :)
Dario Izzo
@darioizzo
May 07 2016 20:48
Its mainly a port of many third party codes written from various scientists .... again .. kinda works and was tested in PaGMO legacy
its damn ugly though .... any suggestions?
Francesco Biscani
@bluescarni
May 07 2016 20:49
oh wow dem arrays :) my first suggestion would be to move them somewhere else
it's hard to navigate
Dario Izzo
@darioizzo
May 07 2016 20:49
we can put them in some detail shit
Francesco Biscani
@bluescarni
May 07 2016 20:50
oh boy it would be so cool to rewrite that using constexpr... talking about the array of prime numbers :)
Dario Izzo
@darioizzo
May 07 2016 20:50
can be done ... wheres the problem ..
Francesco Biscani
@bluescarni
May 07 2016 20:51
I don't know if the naive way of generating primes (the only one I know :) ) would be too slow
but let's keep it to the basics and assume the array is good and does not contain errors :)
Dario Izzo
@darioizzo
May 07 2016 20:52
we can test that array only contains prime numbers in the tests ... just to overkill
Francesco Biscani
@bluescarni
May 07 2016 20:52
lol
https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes oh well this looks like having a reasonable complexity
Marcus Märtens
@CoolRunning
May 07 2016 20:57
// this is how it works now
std::vector<vector_double> x1{ { 1,2 },{ 3,4 } };
hypervolume hv = hypervolume(x1, true);
// this is how I want it to work as well -  how do I do that?
hypervolume hv{ { 1,2 },{ 3,4 } };
Francesco Biscani
@bluescarni
May 07 2016 20:58
you need to add a constructor of hypervolume from std::vector<vector_double>
and I think it should work
Dario Izzo
@darioizzo
May 07 2016 20:58
You need to make a constructor that accept an std::initializer_list
@bluescarni I think he want any number of points
ah right .. sorry delete my words ....
Francesco Biscani
@bluescarni
May 07 2016 20:59
I am not sure it's necessary, as a vector is implicitly ctible from an initializer list
but the only way is to try :)
Marcus Märtens
@CoolRunning
May 07 2016 20:59
Okay, I try... :smile:
Francesco Biscani
@bluescarni
May 07 2016 20:59
but there must be only the vector in the ctor argument
Marcus Märtens
@CoolRunning
May 07 2016 21:02
I now have this constructor, but I does not seem to work
    hypervolume::hypervolume(const std::vector<vector_double> &points) : m_points(points), m_copy_points(true), m_verify(true) { }
ah shit... scoping
hypervolume(const std::vector<vector_double> &points) : m_points(points), m_copy_points(true), m_verify(true) { }
Dario Izzo
@darioizzo
May 07 2016 21:06
What does not work?
Marcus Märtens
@CoolRunning
May 07 2016 21:08
Severity Code Description Project File Line Suppression State
Error (active) no instance of constructor "pagmo::hypervolume::hypervolume" matches the argument list hypervolume c:\PaGMO\PaGMOreborn\tests\hypervolume.cpp 55
Dario Izzo
@darioizzo
May 07 2016 21:08
When you call it how? as Above?
Francesco Biscani
@bluescarni
May 07 2016 21:09
it might be you really need the initializer list syntax I think
I was just reading about it
Marcus Märtens
@CoolRunning
May 07 2016 21:09
hypervolume hv2{ { 1,2 },{ 3,4 } };
Francesco Biscani
@bluescarni
May 07 2016 21:10
I think that if you are implementing a ctor (as opposed to a normal function taking a std:vector param) you need to tell it to use initialzier list
it would be something like this:
hypervolume(std::initializer_list<std::initializer_list<double>> l)
let me check a second
hv(std::initializer_list<std::vector<double>> l):m_points(l) {}
this works on clang and gcc
Marcus Märtens
@CoolRunning
May 07 2016 21:14
Let me try
It works
This is so sick... :)
Dario Izzo
@darioizzo
May 07 2016 21:17
cool stuff
Francesco Biscani
@bluescarni
May 07 2016 21:18
we gonna bash some bots marcus if you wanna join, but if you are on a roll don't let us disturb you :)
Marcus Märtens
@CoolRunning
May 07 2016 21:20
hf
I am still rolling here