MCPcopy Create free account
hub / github.com/davisking/dlib / make_random_vector

Function make_random_vector

dlib/global_optimization/global_function_search.cpp:361–376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

359 // ----------------------------------------------------------------------------------------
360
361 matrix<double,0,1> make_random_vector(
362 dlib::rand& rnd,
363 const matrix<double,0,1>& lower,
364 const matrix<double,0,1>& upper,
365 const std::vector<bool>& is_integer_variable
366 )
367 {
368 matrix<double,0,1> temp(lower.size());
369 for (long i = 0; i < temp.size(); ++i)
370 {
371 temp(i) = rnd.get_double_in_range(lower(i), upper(i));
372 if (is_integer_variable[i])
373 temp(i) = std::round(temp(i));
374 }
375 return temp;
376 }
377
378 // ----------------------------------------------------------------------------------------
379

Callers 1

get_next_xMethod · 0.85

Calls 3

roundFunction · 0.85
get_double_in_rangeMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected