name
stringlengths
1
473k
code
stringlengths
7
647k
asm
stringlengths
4
3.39M
file
stringlengths
8
196
baryonyx::result baryonyx::itm::solve_problem<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::maximize_tag, baryonyx::itm::default_cost_type<float>>, float, baryonyx::itm::maximize_tag, baryonyx::itm::default_cost_type<float>>(baryonyx::context const&, baryonyx::problem const&)
inline result solve_problem(const context& ctx, const problem& pb) { if (ctx.start) ctx.start(ctx.parameters); result ret; auto variables = length(pb.vars.values); auto constraints{ make_merged_constraints(ctx, pb) }; if (!constraints.empty() && !pb.vars.values.empty()) { random_engine rng(init_random_generator_seed(ctx)); auto cost = Cost(pb.objective, variables); auto cost_constant = pb.objective.value; switch (ctx.parameters.observer) { case solver_parameters::observer_type::pnm: { using obs = pnm_observer; solver_functor<Solver, Float, Mode, Cost, obs> slv(ctx, rng); ret = slv(constraints, variables, cost, cost_constant); } break; case solver_parameters::observer_type::file: { using obs = file_observer; solver_functor<Solver, Float, Mode, Cost, obs> slv(ctx, rng); ret = slv(constraints, variables, cost, cost_constant); } break; default: { using obs = none_observer; solver_functor<Solver, Float, Mode, Cost, obs> slv(ctx, rng); ret = slv(constraints, variables, cost, cost_constant); break; } } } else { ret.status = result_status::success; ret.solutions.resize(1); ret.solutions.back().value = pb.objective.value; } ret.strings = pb.strings; ret.variable_name = std::move(pb.vars.names); ret.affected_vars = std::move(pb.affected_vars); ret.variables = variables; ret.constraints = length(constraints); if (ctx.finish) ctx.finish(ret); return ret; }
pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x130, %rsp # imm = 0x130 cmpq $0x0, 0x128(%rsi) movq %rdx, %r15 movq %rsi, %r14 movq %rdi, %rbx je 0x34f97 leaq 0x118(%r14), %rdi movq %r14, %rsi callq 0x3527e vxorps %xmm0, %xmm0, %xmm0 vmovups %zmm0, 0x58(%rbx) vmovups %zmm0, 0x40(%rbx) vmovups %zmm0, (%rbx) movq $0x7fffffff, 0x98(%rbx) # imm = 0x7FFFFFFF movl $0x2, 0xa0(%rbx) movq 0xb0(%r15), %rax subq 0xa8(%r15), %rax pushq $0xc popq %rcx cqto idivq %rcx movq %rax, %r12 leaq 0x8(%rsp), %rdi movq %r14, %rsi movq %r15, %rdx vzeroupper callq 0x450078 movq 0x8(%rsp), %rax cmpq 0x10(%rsp), %rax je 0x350c0 movq 0xa8(%r15), %rax cmpq 0xb0(%r15), %rax je 0x350c0 movq %r14, %rdi callq 0x353ba movl $0x7fffffff, %ecx # imm = 0x7FFFFFFF xorl %edx, %edx leaq 0x10(%r15), %rsi divq %rcx cmpq $0x1, %rdx adcq $0x0, %rdx movq %rdx, (%rsp) leaq 0x20(%rsp), %rdi movl %r12d, %edx callq 0x353d2 vmovsd 0x40(%r15), %xmm0 movl 0xe4(%r14), %eax vxorps %xmm1, %xmm1, %xmm1 leaq 0x30(%rsp), %rsi cmpl $0x1, %eax je 0x350e7 cmpl $0x2, %eax jne 0x35136 movabsq $-0x10000000000000, %r9 # imm = 0xFFF0000000000000 vmovaps %xmm1, (%rsi) movq %r14, 0x10(%rsi) movq %rsp, %rax movq %rax, 0x18(%rsi) vmovaps %xmm1, 0x20(%rsi) movq %r9, 0x30(%rsi) andq $0x0, 0x48(%rsi) vmovups %xmm1, 0x38(%rsi) movl $0x7fffffff, 0x50(%rsi) # imm = 0x7FFFFFFF leaq 0x88(%rsp), %rdi leaq 0x8(%rsp), %rdx leaq 0x20(%rsp), %r8 movl %r12d, %ecx callq 0x41e0c jmp 0x35183 andl $0x0, 0xa0(%rbx) leaq 0x68(%rbx), %rdi pushq $0x1 popq %rsi callq 0x35292 vmovsd 0x40(%r15), %xmm0 movq 0x70(%rbx), %rax vmovsd %xmm0, -0x8(%rax) jmp 0x351b2 movabsq $-0x10000000000000, %r9 # imm = 0xFFF0000000000000 vmovaps %xmm1, (%rsi) movq %r14, 0x10(%rsi) movq %rsp, %rax movq %rax, 0x18(%rsi) vmovaps %xmm1, 0x20(%rsi) movq %r9, 0x30(%rsi) andq $0x0, 0x48(%rsi) vmovups %xmm1, 0x38(%rsi) movl $0x7fffffff, 0x50(%rsi) # imm = 0x7FFFFFFF leaq 0x88(%rsp), %rdi leaq 0x8(%rsp), %rdx leaq 0x20(%rsp), %r8 movl %r12d, %ecx callq 0x416c0 jmp 0x35183 movabsq $-0x10000000000000, %r9 # imm = 0xFFF0000000000000 vmovaps %xmm1, (%rsi) movq %r14, 0x10(%rsi) movq %rsp, %rax movq %rax, 0x18(%rsi) vmovaps %xmm1, 0x20(%rsi) movq %r9, 0x30(%rsi) andq $0x0, 0x48(%rsi) vmovups %xmm1, 0x38(%rsi) movl $0x7fffffff, 0x50(%rsi) # imm = 0x7FFFFFFF leaq 0x88(%rsp), %rdi leaq 0x8(%rsp), %rdx leaq 0x20(%rsp), %r8 movl %r12d, %ecx callq 0x424ea leaq 0x88(%rsp), %r13 movq %rbx, %rdi movq %r13, %rsi callq 0x41d9e movq %r13, %rdi callq 0xea60 leaq 0x58(%rsp), %rdi callq 0x357fe leaq 0x28(%rsp), %rdi callq 0x35c1a leaq 0x90(%r15), %r13 movq %rbx, %rdi movq %r15, %rsi callq 0x31d28 leaq 0x50(%rbx), %rdi movq %r13, %rsi callq 0x352ec addq $0xc0, %r15 leaq 0x20(%rbx), %rdi movq %r15, %rsi callq 0x352c2 movq 0x10(%rsp), %rax movl %r12d, 0x90(%rbx) subq 0x8(%rsp), %rax pushq $0x28 popq %rcx cqto idivq %rcx movl %eax, 0x94(%rbx) cmpq $0x0, 0x168(%r14) je 0x3521e addq $0x158, %r14 # imm = 0x158 movq %r14, %rdi movq %rbx, %rsi callq 0x357ea leaq 0x8(%rsp), %rdi callq 0x35858 movq %rbx, %rax addq $0x130, %rsp # imm = 0x130 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 retq jmp 0x35240 jmp 0x35240 leaq 0x58(%rsp), %rdi movq %rax, %r14 callq 0x357fe leaq 0x28(%rsp), %rdi callq 0x35c1a jmp 0x35263 jmp 0x35260 movq %rax, %r14 jmp 0x3526d movq %rax, %r14 leaq 0x8(%rsp), %rdi callq 0x35858 movq %rbx, %rdi callq 0xea60 movq %r14, %rdi callq 0xb3d0 nop
/quesnel[P]baryonyx/lib/src/itm-solver-common.hpp
baryonyx::itm::default_cost_type<float>::default_cost_type(baryonyx::objective_function const&, int)
default_cost_type(const objective_function& obj_, int n) : obj(obj_) , linear_elements(std::make_unique<Float[]>(n)) { for (const auto& elem : obj.elements) { bx_ensures(0 <= elem.variable_index && elem.variable_index < n); linear_elements[elem.variable_index] += static_cast<Float>(elem.factor); } }
pushq %r14 pushq %rbx pushq %rax movq %rsi, (%rdi) movq %rdi, %r14 addq $0x8, %rdi movslq %edx, %rsi movl %edx, %ebx callq 0x35bd8 movq (%r14), %rdx movq 0x8(%r14), %rax movq (%rdx), %rcx movq 0x8(%rdx), %rdx cmpq %rdx, %rcx je 0x3541e movslq 0x8(%rcx), %rsi testq %rsi, %rsi js 0x35426 cmpl %ebx, %esi jge 0x35426 vcvtsd2ss (%rcx), %xmm1, %xmm0 addq $0x10, %rcx vaddss (%rax,%rsi,4), %xmm0, %xmm0 vmovss %xmm0, (%rax,%rsi,4) jmp 0x353f8 addq $0x8, %rsp popq %rbx popq %r14 retq leaq 0x422ffd(%rip), %rdi # 0x45842a leaq 0x424b24(%rip), %rsi # 0x459f58 leaq 0x424b51(%rip), %rdx # 0x459f8c leaq 0x424ba6(%rip), %rcx # 0x459fe8 callq 0x2813f
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::itm::get_thread_number(baryonyx::context const&)
inline unsigned get_thread_number(const baryonyx::context& ctx) noexcept { unsigned ret; if (ctx.parameters.thread <= 0) ret = std::thread::hardware_concurrency(); else ret = static_cast<unsigned>(ctx.parameters.thread); if (ret == 0) return 1; return ret; }
movl 0xac(%rdi), %eax testl %eax, %eax jg 0x3545b pushq %rax callq 0xb4f0 addq $0x8, %rsp cmpl $0x1, %eax adcl $0x0, %eax retq
/quesnel[P]baryonyx/lib/src/itm-optimizer-common.hpp
baryonyx::itm::generate_seed(std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>&, unsigned int)
inline std::unique_ptr<random_engine::result_type[]> generate_seed(random_engine& rng, unsigned thread_id) { using type = random_engine::result_type; auto ret = std::make_unique<type[]>(thread_id); std::uniform_int_distribution<type> dst(std::numeric_limits<type>::min(), std::numeric_limits<type>::max()); ret[0] = numeric_cast<type>(dst(rng)); for (unsigned i = 1; i != thread_id; ++i) { ret[i] = numeric_cast<type>(dst(rng)); unsigned j = i - 1; while (j > 0) { if (ret[j] == ret[i]) { ret[j] = numeric_cast<type>(dst(rng)); j = i; } --j; } } return ret; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x18, %rsp movq %rsi, %r14 movl %edx, %esi movq %rdi, %rbx movl %edx, 0x4(%rsp) callq 0x36902 leaq 0x8(%rsp), %rdi andq $0x0, (%rdi) orq $-0x1, 0x8(%rdi) movq %r14, %rsi callq 0x3709a movq (%rbx), %rcx movq %rax, (%rcx) pushq $0x1 popq %r12 xorl %r13d, %r13d cmpl 0x4(%rsp), %r12d je 0x355af leaq 0x8(%rsp), %rdi movq %r14, %rsi callq 0x3709a movl %r12d, %r15d movq %r15, %rbp movq (%rbx), %rcx movl %r13d, %edx movq %rax, (%rcx,%rbp,8) movl %r13d, %eax subl $0x1, %eax jb 0x355a7 movl %edx, %ebp movq (%rcx,%rbp,8), %rsi movl %eax, %edx cmpq (%rcx,%r15,8), %rsi jne 0x35585 leaq 0x8(%rsp), %rdi movq %r14, %rsi callq 0x3709a jmp 0x35578 incl %r12d incl %r13d jmp 0x3555e movq %rbx, %rax addq $0x18, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq jmp 0x355c5 jmp 0x355c5 movq %rbx, %rdi movq %rax, %r14 callq 0x357fe movq %r14, %rdi callq 0xb3d0
/quesnel[P]baryonyx/lib/src/itm-common.hpp
void baryonyx::convert<baryonyx::itm::maximize_tag>(baryonyx::raw_result<baryonyx::itm::maximize_tag> const&, baryonyx::solution&, int)
void convert(const raw_result<Mode>& source, solution& sol, int variables) { sol.value = source.value; sol.variables.resize(variables); for (int i = 0; i != variables; ++i) sol.variables[i] = static_cast<var_value>(source.x[i]); }
pushq %r15 pushq %r14 pushq %r12 pushq %rbx pushq %rax vmovsd 0x10(%rdi), %xmm0 movslq %edx, %r15 movq %rdi, %r14 movq %rsi, %rbx movq %rsi, %rdi vmovsd %xmm0, 0x18(%rsi) movq %r15, %rsi callq 0x41362 movl %r15d, %r12d xorl %r15d, %r15d cmpq %r15, %r12 je 0x357c9 movq %r14, %rdi movl %r15d, %esi callq 0x3664a movq (%rbx), %rcx movb %al, (%rcx,%r15) incq %r15 jmp 0x357ad addq $0x8, %rsp popq %rbx popq %r12 popq %r14 popq %r15 retq nop
/quesnel[P]baryonyx/lib/src/result.hpp
baryonyx::itm::storage<baryonyx::itm::default_cost_type<float>, baryonyx::itm::maximize_tag>::storage(std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>&, baryonyx::itm::default_cost_type<float> const&, double, int, int, std::vector<baryonyx::itm::merged_constraint, std::allocator<baryonyx::itm::merged_constraint>> const&)
storage(random_engine& rng, const Cost& costs_, const double cost_constant_, const int population_size, const int variables, const std::vector<merged_constraint>& constraints_) : m_indices(population_size) , m_data(population_size) , m_bastert(variables) , m_random(variables) , costs(costs_) , cost_constant(cost_constant_) , m_size(population_size) { for (auto& elem : m_data) elem.x = bit_array(variables); init_with_bastert<Cost, Mode>(m_bastert, costs_, variables, 0); for (int i = 0, e = m_size / 2; i != e; ++i) { m_data[i].x = m_bastert; std::bernoulli_distribution dist( std::clamp(static_cast<double>(i) / (5 * e), 0.0, 1.0)); for (int v = 0; v != variables; ++v) if (dist(rng)) m_data[i].x.invert(v); } for (int i = m_size / 2, e = m_size; i + 1 < e; i += 2) { init_with_random(m_data[i].x, rng, variables, 0.2); init_with_random(m_data[i + 1].x, rng, variables, 0.8); init_with_pre_solve<Cost, Mode>( m_data[i].x, m_data[i + 1].x, rng, costs_, constraints_, std::clamp(static_cast<double>(i) / (5 * e), 0.0, 1.0)); } for (int i = 0, e = m_size; i != e; ++i) { m_data[i].make_hash(); m_data[i].value = costs.results(m_data[i].x, cost_constant_); m_data[i].remaining_constraints = 0; for (int k = 0, end_k = length(constraints_); k != end_k; ++k) { int sum = 0; for (const auto& elem : constraints_[k].elements) { if (m_data[i].x[elem.variable_index]) sum += elem.factor; } if (!(constraints_[k].min <= sum && sum <= constraints_[k].max)) ++m_data[i].remaining_constraints; } } std::iota(std::begin(m_indices), std::end(m_indices), 0); sort(); }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x68, %rsp vmovsd %xmm0, 0x40(%rsp) vxorpd %xmm0, %xmm0, %xmm0 movq %rdx, 0x18(%rsp) movq %rdi, %r15 movslq %ecx, %r12 leaq 0x58(%rsp), %rdx movq %rsi, %r13 movq %r9, 0x28(%rsp) movl %r8d, %ebp movl %ecx, %ebx vmovupd %ymm0, 0x18(%rdi) vmovupd %ymm0, (%rdi) addq $0x38, %rdi movq %r12, %rsi movq %rdi, 0x48(%rsp) vzeroupper callq 0x3140c leaq 0x50(%r15), %r14 leaq 0x58(%rsp), %rdx movq %r14, %rdi movq %r12, %rsi callq 0x36194 leaq 0x68(%r15), %rdi movl %ebp, %esi movq %rdi, 0x10(%rsp) callq 0x368ae leaq 0x78(%r15), %rdi movl %ebp, %esi callq 0x368ae vmovsd 0x40(%rsp), %xmm0 movq 0x18(%rsp), %rax movq %r15, 0x8(%rsp) leaq 0x58(%rsp), %r12 movq %rax, 0x88(%r15) vmovsd %xmm0, 0x90(%r15) movl %ebx, 0x98(%r15) movq 0x50(%r15), %rbx movq 0x58(%r15), %r15 cmpq %r15, %rbx je 0x35e1d movq %r12, %rdi movl %ebp, %esi callq 0x368ae movq %rbx, %rdi movq %r12, %rsi callq 0x3696c leaq 0x60(%rsp), %rdi callq 0x357fe addq $0x38, %rbx jmp 0x35df3 movq 0x10(%rsp), %rdi movq 0x18(%rsp), %rsi xorl %r15d, %r15d movl %ebp, %edx xorl %ecx, %ecx callq 0x361e7 movq 0x8(%rsp), %rax movl 0x98(%rax), %eax pushq $0x2 popq %rcx cltd idivl %ecx movq %rax, 0x20(%rsp) leal (%rax,%rax,4), %eax vcvtsi2sd %eax, %xmm1, %xmm0 vmovsd %xmm0, 0x50(%rsp) cmpq 0x20(%rsp), %r15 je 0x35ecf movq (%r14), %rdi imulq $0x38, %r15, %r12 addq %r12, %rdi movq 0x10(%rsp), %rsi callq 0x36a44 vcvtsi2sd %r15d, %xmm3, %xmm0 vdivsd 0x50(%rsp), %xmm0, %xmm0 vmovsd 0x41e1b4(%rip), %xmm1 # 0x454038 xorl %ebx, %ebx vminsd %xmm0, %xmm1, %xmm2 vxorpd %xmm1, %xmm1, %xmm1 vcmpltsd %xmm1, %xmm0, %k1 vmovsd %xmm1, %xmm2, %xmm2 {%k1} vmovapd %xmm2, 0x30(%rsp) cmpl %ebx, %ebp je 0x35eca movq %r13, %rdi callq 0x36ac3 vmovapd 0x30(%rsp), %xmm1 vucomisd %xmm0, %xmm1 jbe 0x35ec6 movq (%r14), %rdi movl %ebx, %esi addq %r12, %rdi callq 0x3626e incl %ebx jmp 0x35ea1 incq %r15 jmp 0x35e56 movq 0x8(%rsp), %rax movslq 0x98(%rax), %rsi movl %esi, %eax cltd pushq $0x2 popq %rcx idivl %ecx leal (%rsi,%rsi,4), %ecx movq %rsi, 0x30(%rsp) vcvtsi2sd %ecx, %xmm3, %xmm0 vmovsd %xmm0, 0x10(%rsp) movslq %eax, %r12 movl %eax, %r15d imulq $0x38, %r12, %rbx incq %r12 cmpq 0x30(%rsp), %r12 jge 0x35f95 vmovsd 0x423b73(%rip), %xmm0 # 0x459a88 movq (%r14), %rdi movq %r13, %rsi movl %ebp, %edx addq %rbx, %rdi callq 0x362ac vmovsd 0x423b63(%rip), %xmm0 # 0x459a90 movq (%r14), %rax movq %r13, %rsi movl %ebp, %edx leaq 0x38(%rax,%rbx), %rdi callq 0x362ac vcvtsi2sd %r15d, %xmm3, %xmm0 vdivsd 0x10(%rsp), %xmm0, %xmm1 vmovsd 0x41e0e6(%rip), %xmm0 # 0x454038 movq (%r14), %rdi movq 0x18(%rsp), %rcx movq 0x28(%rsp), %r8 vxorpd %xmm2, %xmm2, %xmm2 movq %r13, %rdx leaq 0x38(%rdi,%rbx), %rsi addq %rbx, %rdi vcmpltsd %xmm2, %xmm1, %k1 vminsd %xmm1, %xmm0, %xmm0 vmovsd %xmm2, %xmm0, %xmm0 {%k1} callq 0x36301 addl $0x2, %r15d addq $0x70, %rbx addq $0x2, %r12 jmp 0x35f02 movq 0x8(%rsp), %rax movl 0x98(%rax), %eax movq %rax, 0x20(%rsp) xorl %eax, %eax cmpq 0x20(%rsp), %rax je 0x3608c movq 0x8(%rsp), %rbx imulq $0x38, %rax, %rbp movq %rax, 0x10(%rsp) movq 0x50(%rbx), %rdi addq %rbp, %rdi callq 0x365b4 vmovsd 0x40(%rsp), %xmm0 movq 0x50(%rbx), %rsi movq 0x88(%rbx), %rdi addq %rbp, %rsi callq 0x365d4 movq 0x50(%rbx), %rax vmovsd %xmm0, 0x10(%rax,%rbp) andl $0x0, 0x30(%rax,%rbp) movq 0x28(%rsp), %rax movq (%rax), %rcx movq 0x8(%rax), %rax subq %rcx, %rax cqto pushq $0x28 popq %rsi idivq %rsi movl %eax, %eax movq %rax, 0x18(%rsp) xorl %eax, %eax cmpq 0x18(%rsp), %rax je 0x3607f imulq $0x28, %rax, %r12 movq %rax, 0x30(%rsp) xorl %r15d, %r15d movq (%rcx,%r12), %r13 movq 0x8(%rcx,%r12), %rbx cmpq %rbx, %r13 je 0x36055 movq (%r14), %rdi movl 0x4(%r13), %esi addq %rbp, %rdi callq 0x3664a testl %eax, %eax je 0x3604c movl (%r13), %eax addl %eax, %r15d addq $0x8, %r13 jmp 0x36030 movq 0x28(%rsp), %rax movq (%rax), %rcx cmpl %r15d, 0x18(%rcx,%r12) jg 0x3606e addq %rcx, %r12 cmpl 0x1c(%r12), %r15d jle 0x36075 movq (%r14), %rax incl 0x30(%rax,%rbp) movq 0x30(%rsp), %rax incq %rax jmp 0x36014 movq 0x10(%rsp), %rax incq %rax jmp 0x35fa7 movq 0x8(%rsp), %rdi xorl %edx, %edx movq 0x38(%rdi), %rax movq 0x40(%rdi), %rcx cmpq %rcx, %rax je 0x360aa movl %edx, (%rax) incl %edx addq $0x4, %rax jmp 0x3609b callq 0x36666 addq $0x68, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq movq %rax, %rbx jmp 0x360e5 movq %rax, %rbx jmp 0x360f1 movq %rax, %rbx jmp 0x360f9 jmp 0x360d1 jmp 0x360d1 movq 0x8(%rsp), %r15 movq %rax, %rbx leaq 0x80(%r15), %rdi callq 0x357fe addq $0x70, %r15 movq %r15, %rdi callq 0x357fe movq %r14, %rdi callq 0x36742 movq 0x48(%rsp), %rdi callq 0x26a34 movq %rbx, %rdi callq 0xb3d0 nop
/quesnel[P]baryonyx/lib/src/itm-optimizer-common.hpp
baryonyx::itm::init_with_random(baryonyx::bit_array&, std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>&, int, double)
inline void init_with_random(bit_array& x, random_engine& rng, const int variables, const double init_ramdom) noexcept { std::bernoulli_distribution dist(init_ramdom); for (int i = 0; i != variables; ++i) if (dist(rng)) x.set(i); else x.unset(i); }
pushq %rbp pushq %r15 pushq %r14 pushq %rbx pushq %rax vmovsd %xmm0, (%rsp) movl %edx, %ebx movq %rsi, %r14 movq %rdi, %r15 xorl %ebp, %ebp cmpl %ebp, %ebx je 0x362ee movq %r14, %rdi callq 0x36ac3 vmovsd (%rsp), %xmm1 movq %r15, %rdi movl %ebp, %esi vucomisd %xmm0, %xmm1 jbe 0x362e5 callq 0x369c8 jmp 0x362ea callq 0x36a06 incl %ebp jmp 0x362c2 addq $0x8, %rsp popq %rbx popq %r14 popq %r15 popq %rbp retq movq %rax, %rdi callq 0xeb9f
/quesnel[P]baryonyx/lib/src/itm-common.hpp
void baryonyx::itm::init_with_pre_solve<baryonyx::itm::default_cost_type<float>, baryonyx::itm::maximize_tag>(baryonyx::bit_array&, baryonyx::bit_array&, std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>&, baryonyx::itm::default_cost_type<float> const&, std::vector<baryonyx::itm::merged_constraint, std::allocator<baryonyx::itm::merged_constraint>> const&, double)
void init_with_pre_solve(bit_array& x_pessimistic, bit_array& x_optimistic, random_engine& rng, const Cost& c, const std::vector<merged_constraint>& constraints, const double init_random) noexcept { int max_length = 0; for (const auto& cst : constraints) if (length(cst.elements) > max_length) max_length = length(cst.elements); struct reduced_cost { float value; int factor; int id; }; std::vector<reduced_cost> R(max_length); std::bernoulli_distribution dist(init_random); for (const auto& cst : constraints) { if (!dist(rng)) continue; R.resize(cst.elements.size()); const int r_size = length(cst.elements); for (int i = 0; i != r_size; ++i) { R[i].value = static_cast<float>(c[cst.elements[i].variable_index]); R[i].factor = cst.elements[i].factor; R[i].id = cst.elements[i].variable_index; } std::shuffle(std::begin(R), std::end(R), rng); std::sort( std::begin(R), std::end(R), [](const auto& lhs, const auto& rhs) { return is_better_solution<Mode>(lhs.value, rhs.value); }); if (!x_pessimistic.empty()) { int sum = 0; int best = -2; for (int i = -1; i < r_size; ++i) { if (cst.min <= sum && sum <= cst.max) { best = i; break; } if (i + 1 < r_size) sum += R[i + 1].factor; } int i = 0; for (; i <= best; ++i) x_pessimistic.set(R[i].id); for (; i != r_size; ++i) { x_pessimistic.unset(R[i].id); } } if (!x_optimistic.empty()) { int sum = 0; int best = -2; for (int i = -1; i < r_size; ++i) { if (cst.min <= sum && sum <= cst.max) best = i; if (best != -2 && i + 1 < r_size && stop_iterating<Mode>(R[i + 1].value)) break; if (i + 1 < r_size) sum += R[i + 1].factor; } int i = 0; for (; i <= best; ++i) x_optimistic.set(R[i].id); for (; i != r_size; ++i) x_optimistic.unset(R[i].id); } } }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x58, %rsp movq %rcx, 0x38(%rsp) movq (%r8), %rax movq 0x8(%r8), %rcx movq %rdx, 0x30(%rsp) vmovsd %xmm0, 0x48(%rsp) movq %r8, %r13 xorl %edx, %edx movq %rsi, 0x28(%rsp) movq %rdi, 0x20(%rsp) cmpq %rcx, %rax je 0x36352 movq 0x8(%rax), %rsi subq (%rax), %rsi shrq $0x3, %rsi cmpl %esi, %edx cmovgl %edx, %esi addq $0x28, %rax movl %esi, %edx jmp 0x36335 movl %edx, %esi leaq 0x8(%rsp), %rdi leaq 0x7(%rsp), %rdx callq 0x36baa movq 0x8(%r13), %rax movq (%r13), %rbp movq 0x30(%rsp), %r13 movq %rax, 0x50(%rsp) cmpq 0x50(%rsp), %rbp je 0x36591 movq %r13, %rdi callq 0x36ac3 vmovsd 0x48(%rsp), %xmm1 vucomisd %xmm0, %xmm1 jbe 0x36588 movq 0x8(%rbp), %rsi subq (%rbp), %rsi sarq $0x3, %rsi leaq 0x8(%rsp), %rdi callq 0x36bfe movq 0x38(%rsp), %rcx movq (%rbp), %rax movq 0x8(%rbp), %r15 movq 0x8(%rsp), %rdx movl $0x2003, %esi # imm = 0x2003 movq 0x8(%rcx), %rcx subq %rax, %r15 addq $0x4, %rdx bextrq %rsi, %r15, %r14 xorl %esi, %esi cmpq %rsi, %r14 je 0x363fe movq (%rax,%rsi,8), %rdi incq %rsi movq %rdi, %r8 sarq $0x20, %r8 vmovss (%rcx,%r8,4), %xmm0 vmovss %xmm0, -0x4(%rdx) movq %rdi, (%rdx) addq $0xc, %rdx jmp 0x363d7 movq 0x8(%rsp), %rdi movq 0x10(%rsp), %rsi movq %r13, %rdx callq 0x36c36 movq 0x8(%rsp), %rdi movq 0x10(%rsp), %rsi callq 0x371dc movq 0x20(%rsp), %rax cmpq $0x0, 0x8(%rax) je 0x364ca movq 0x8(%rsp), %rax movq %r15, %rcx shrq $0x3, %rcx xorl %esi, %esi movslq %ecx, %rdx addq $0x4, %rax pushq $-0x1 popq %rcx movq %r15, 0x40(%rsp) imulq $0xc, %rcx, %rdi addq %rax, %rdi cmpq %rdx, %rcx jge 0x36472 cmpl %esi, 0x18(%rbp) jg 0x36462 cmpl 0x1c(%rbp), %esi jle 0x36475 incq %rcx addq $0xc, %rdi cmpq %rdx, %rcx jge 0x36453 addl (%rdi), %esi jmp 0x3644c pushq $-0x2 popq %rcx movslq %ecx, %r15 movq %r14, %rbx pushq $0x8 popq %r13 xorl %r12d, %r12d cmpq %r15, %r12 jg 0x364a6 movq 0x8(%rsp), %rax movq 0x20(%rsp), %rdi movl (%rax,%r13), %esi callq 0x369c8 incq %r12 addq $0xc, %r13 decq %rbx jmp 0x36482 movq 0x40(%rsp), %r15 subq $0x1, %rbx jb 0x364ca movq 0x8(%rsp), %rax movq 0x20(%rsp), %rdi movl (%rax,%r13), %esi callq 0x36a06 addq $0xc, %r13 jmp 0x364ab movq 0x28(%rsp), %rax movq 0x30(%rsp), %r13 cmpq $0x0, 0x8(%rax) je 0x36588 movq 0x8(%rsp), %rax shrq $0x3, %r15 xorl %edx, %edx movslq %r15d, %rcx addq $0xc, %rax pushq $-0x1 popq %rsi pushq $-0x2 popq %rdi imulq $0xc, %rsi, %r8 addq %rax, %r8 movl %edi, %r9d cmpq %rcx, %rsi jge 0x36540 cmpl 0x1c(%rbp), %edx movl %esi, %edi cmovgl %r9d, %edi cmpl %edx, 0x18(%rbp) cmovgl %r9d, %edi incq %rsi cmpl $-0x2, %edi je 0x3652e cmpq %rcx, %rsi jge 0x3652e vxorpd %xmm0, %xmm0, %xmm0 vucomiss (%r8), %xmm0 ja 0x3653d addq $0xc, %r8 cmpq %rcx, %rsi jge 0x364fe addl -0x8(%r8), %edx jmp 0x364f7 movl %edi, %r9d movslq %r9d, %r15 pushq $0x8 popq %rbx xorl %r12d, %r12d cmpq %r15, %r12 jg 0x36582 movq 0x8(%rsp), %rax movq 0x28(%rsp), %rdi movl (%rax,%rbx), %esi callq 0x369c8 incq %r12 addq $0xc, %rbx decq %r14 jmp 0x36549 movq 0x8(%rsp), %rax movq 0x28(%rsp), %rdi movl (%rax,%rbx), %esi callq 0x36a06 addq $0xc, %rbx subq $0x1, %r14 jae 0x3656c addq $0x28, %rbp jmp 0x36375 leaq 0x8(%rsp), %rdi callq 0x36e42 addq $0x58, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq jmp 0x365ac movq %rax, %rdi callq 0xeb9f
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::itm::default_cost_type<float>::results(baryonyx::bit_array const&, double) const
double results(const bit_array& x, double cost_constant) const noexcept { for (int i = 0, e = length(obj.elements); i != e; ++i) if (x[obj.elements[i].variable_index]) cost_constant += obj.elements[i].factor; return cost_constant; }
pushq %r15 pushq %r14 pushq %r12 pushq %rbx pushq %rax movq (%rdi), %rax movabsq $0xffffffff0, %r15 # imm = 0xFFFFFFFF0 vmovsd %xmm0, (%rsp) movq %rsi, %rbx movq %rdi, %r14 xorl %r12d, %r12d movq 0x8(%rax), %rcx subq (%rax), %rcx andq %rcx, %r15 cmpq %r12, %r15 je 0x36639 movq (%r14), %rax movq %rbx, %rdi movq (%rax), %rax movl 0x8(%rax,%r12), %esi callq 0x3664a testl %eax, %eax je 0x36633 movq (%r14), %rax vmovsd (%rsp), %xmm0 movq (%rax), %rax vaddsd (%rax,%r12), %xmm0, %xmm0 vmovsd %xmm0, (%rsp) addq $0x10, %r12 jmp 0x36601 vmovsd (%rsp), %xmm0 addq $0x8, %rsp popq %rbx popq %r12 popq %r14 popq %r15 retq
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::itm::storage<baryonyx::itm::default_cost_type<float>, baryonyx::itm::maximize_tag>::sort()
void sort() noexcept { m_indices_writer lock{ m_indices_mutex }; std::sort( std::begin(m_indices), std::end(m_indices), [this](int i1, int i2) { const int cst_1 = this->m_data[i1].remaining_constraints; const int cst_2 = this->m_data[i2].remaining_constraints; const double value_1 = this->m_data[i1].value; const double value_2 = this->m_data[i2].value; if (cst_1 < cst_2) return true; if (cst_1 == cst_2) return is_better_solution<Mode>(value_1, value_2); return false; }); #ifdef BARYONYX_ENABLE_DEBUG to_log(stdout, 3u, "- Solutions init population:\n"); for (int i = 0; i != m_size; ++i) { to_log(stdout, 5u, "- {} id {} value {} constraint {} hash {}\n", i, m_indices[i], m_data[m_indices[i]].value, m_data[m_indices[i]].remaining_constraints, m_data[m_indices[i]].hash); } #endif }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x18, %rsp movq %rdi, %rbx leaq 0x8(%rsp), %rdi movq %rbx, %rsi callq 0x377e6 movq 0x38(%rbx), %rdi movq 0x40(%rbx), %rsi movq %rbx, %rdx callq 0x37909 movq 0x60692d(%rip), %r13 # 0x63cfc8 movq (%r13), %rdi leaq 0x4239f2(%rip), %rcx # 0x45a098 pushq $0x3 popq %rsi pushq $0x1d popq %rdx callq 0x377fc leaq 0x4239fe(%rip), %r14 # 0x45a0b6 xorl %eax, %eax pushq $0x5 popq %rbp pushq $0x2a popq %r15 leaq 0x4(%rsp), %r12 movl %eax, 0x4(%rsp) cmpl 0x98(%rbx), %eax je 0x3671f movq 0x38(%rbx), %rcx cltq movq 0x50(%rbx), %rdx movq (%r13), %rdi leaq (%rcx,%rax,4), %r9 movslq (%r9), %rax imulq $0x38, %rax, %rax leaq 0x10(%rdx,%rax), %r10 leaq 0x30(%rdx,%rax), %r11 leaq 0x20(%rdx,%rax), %rax subq $0x8, %rsp movq %r15, %rdx movl %ebp, %esi movq %r14, %rcx movq %r12, %r8 pushq %rax pushq %r11 pushq %r10 callq 0x3783f addq $0x20, %rsp movl 0x4(%rsp), %eax incl %eax jmp 0x366c6 leaq 0x8(%rsp), %rdi callq 0x378b4 addq $0x18, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq jmp 0x3673a movq %rax, %rdi callq 0xeb9f
/quesnel[P]baryonyx/lib/src/itm-optimizer-common.hpp
baryonyx::bit_array_impl::bit_array_impl(int)
bit_array_impl(int size) : m_size(size) , m_block_size((m_size / bit_per_block) + 1) , m_data(std::make_unique<underlying_type[]>(m_block_size)) { std::fill_n(m_data.get(), m_block_size, k_zeros); }
pushq %r14 pushq %rbx pushq %rax movl %esi, %eax movq %rdi, %r14 movl %esi, (%rdi) pushq $0x40 popq %rcx cltd leaq 0x8(%rdi), %rbx idivl %ecx incl %eax movslq %eax, %rsi movl %eax, 0x4(%rdi) movq %rbx, %rdi callq 0x36902 movq 0x8(%r14), %rdi movl 0x4(%r14), %esi leaq 0x423e5e(%rip), %rdx # 0x45a740 callq 0x36943 addq $0x8, %rsp popq %rbx popq %r14 retq movq %rbx, %rdi movq %rax, %r14 callq 0x357fe movq %r14, %rdi callq 0xb3d0
/quesnel[P]baryonyx/lib/src/bit-array.hpp
baryonyx::itm::solver_functor<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::maximize_tag, baryonyx::itm::default_cost_type<float>>, float, baryonyx::itm::maximize_tag, baryonyx::itm::default_cost_type<float>, baryonyx::file_observer>::is_timelimit_reached()
bool is_timelimit_reached() { m_end = std::chrono::steady_clock::now(); return is_time_limit(m_ctx.parameters.time_limit, m_begin, m_end); }
pushq %rbx movq %rdi, %rbx callq 0xb5a0 movq %rax, 0x8(%rbx) vxorpd %xmm2, %xmm2, %xmm2 movq 0x10(%rbx), %rcx subq (%rbx), %rax vmovsd (%rcx), %xmm0 vcvtsi2sd %rax, %xmm1, %xmm1 vdivsd 0x4164c7(%rip), %xmm1, %xmm1 # 0x459a80 vcmpnlepd %xmm2, %xmm0, %k1 vcmpltpd %xmm1, %xmm0, %k0 {%k1} kmovd %k0, %eax andb $0x1, %al popq %rbx retq nop
/quesnel[P]baryonyx/lib/src/itm-solver-common.hpp
baryonyx::details::pi_file_observer::pi_file_observer(std::basic_string_view<char, std::char_traits<char>>, int, int, long)
pi_file_observer(const std::string_view filename, int m, int /*n*/, long int /*loop*/) : constraints(m) , m_ofs(fmt::format("{}-pi.txt", filename)) {}
pushq %r15 pushq %r14 pushq %rbx subq $0x30, %rsp movq %rdi, %rbx movl %ecx, (%rdi) leaq 0x20(%rsp), %r14 leaq 0x417025(%rip), %rdi # 0x45a62d addq $0x8, %rbx movq %rdx, (%r14) movq %rsi, 0x8(%r14) callq 0xf277 movq %rsp, %r15 pushq $0xd popq %rcx movq %r15, %rdi movq %rax, %rsi movq %r14, %r8 callq 0x1adbb pushq $0x10 popq %rdx movq %rbx, %rdi movq %r15, %rsi callq 0xb120 movq %rsp, %rdi callq 0xe956 addq $0x30, %rsp popq %rbx popq %r14 popq %r15 retq movq %rsp, %rdi movq %rax, %rbx callq 0xe956 movq %rbx, %rdi callq 0xb3d0 nop
/quesnel[P]baryonyx/lib/src/observer.hpp
baryonyx::details::ap_file_observer::ap_file_observer(std::basic_string_view<char, std::char_traits<char>>, int, int, long)
ap_file_observer(const std::string_view filename, int m, int n, long int /*loop*/) : constraints(m) , variables(n) , m_frame(0) , m_basename(std::move(filename)) , m_value(variables) {}
pushq %r14 pushq %rbx subq $0x18, %rsp leaq 0x8(%rsp), %rax leaq 0x10(%rdi), %rbx movq %rdi, %r14 movq %rsi, (%rax) movq %rdx, 0x8(%rax) movl %ecx, (%rdi) movl %r8d, 0x4(%rdi) andl $0x0, 0x8(%rdi) leaq 0x7(%rsp), %rdx movq %rbx, %rdi movq %rax, %rsi callq 0x23460 movslq 0x4(%r14), %rsi addq $0x30, %r14 leaq 0x7(%rsp), %rdx movq %r14, %rdi callq 0x436c4 addq $0x18, %rsp popq %rbx popq %r14 retq movq %rbx, %rdi movq %rax, %r14 callq 0xe956 movq %r14, %rdi callq 0xb3d0
/quesnel[P]baryonyx/lib/src/observer.hpp
void baryonyx::details::pi_file_observer::make_observation<float>(baryonyx::sparse_matrix<int> const&, float const*, float const*)
void make_observation(const sparse_matrix<int>& /*ap*/, const Float* /*P*/, const Float* pi) { static_assert(std::is_floating_point<Float>::value); if (m_ofs) { if (m_len > 1) { m_ofs << pi[0]; for (int i = 1; i != constraints; ++i) m_ofs << ' ' << pi[i]; } else { m_ofs << pi[0]; } m_ofs << '\n'; } }
movq 0x8(%rdi), %rax movq -0x18(%rax), %rax testb $0x5, 0x28(%rdi,%rax) je 0x43830 retq pushq %rbp pushq %r15 pushq %r14 pushq %r12 pushq %rbx vmovss (%rcx), %xmm0 movl 0x4(%rdi), %ebp leaq 0x8(%rdi), %r15 movq %rdi, %r14 movq %rcx, %rbx movq %r15, %rdi callq 0xb660 cmpl $0x2, %ebp jl 0x43882 pushq $0x1 popq %r12 pushq $0x20 popq %rbp movl (%r14), %eax cmpq %rax, %r12 je 0x43882 movq %r15, %rdi movl %ebp, %esi callq 0xb400 vmovss (%rbx,%r12,4), %xmm0 movq %rax, %rdi callq 0xb660 incq %r12 jmp 0x4385d pushq $0xa popq %rsi movq %r15, %rdi popq %rbx popq %r12 popq %r14 popq %r15 popq %rbp jmp 0xb400 nop
/quesnel[P]baryonyx/lib/src/observer.hpp
void baryonyx::details::ap_file_observer::make_observation<float>(baryonyx::sparse_matrix<int> const&, float const*, float const*)
void make_observation(const sparse_matrix<int>& ap, const Float* P, const Float* /*pi*/) { static_assert(std::is_floating_point<Float>::value); std::ofstream ofs(fmt::format("{}-P-{}.txt", m_basename, m_frame++)); for (int k = 0; k != constraints; ++k) { std::fill_n(std::begin(m_value), variables, 0.0f); auto [it, et] = ap.row(k); for (; it != et; ++it) m_value[it->column] = static_cast<float>(P[it->value]); std::copy(m_value.begin(), m_value.end(), std::ostream_iterator<Float>(ofs, " ")); ofs << '\n'; } }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x258, %rsp # imm = 0x258 movl 0x8(%rdi), %eax movq %rdi, %r15 movq %rdx, %rbx movq %rsi, %r14 movq %rsp, %r12 leal 0x1(%rax), %ecx movl %ecx, 0x8(%rdi) vmovups 0x10(%rdi), %xmm0 leaq 0x416d6f(%rip), %rdi # 0x45a637 vmovaps %xmm0, (%r12) movq %rax, 0x10(%r12) callq 0xf277 leaq 0x38(%rsp), %r13 pushq $0x1d popq %rcx movq %r13, %rdi movq %rax, %rsi movq %r12, %r8 callq 0x1adbb leaq 0x58(%rsp), %r12 pushq $0x10 popq %rdx movq %r12, %rdi movq %r13, %rsi callq 0xb120 leaq 0x38(%rsp), %rdi callq 0xe956 xorl %ebp, %ebp movq %rsp, %r13 cmpl (%r15), %ebp je 0x4399e movq 0x30(%r15), %rdi movl 0x4(%r15), %esi andl $0x0, (%rsp) movq %r13, %rdx callq 0x43a03 movq %r13, %rdi movq %r14, %rsi movl %ebp, %edx callq 0x3c868 movq (%rsp), %rax movq 0x8(%rsp), %rcx movq 0x30(%r15), %rsi cmpq %rax, %rcx je 0x43968 movslq (%rcx), %rdx vmovss (%rbx,%rdx,4), %xmm0 movslq 0x4(%rcx), %rdx addq $0x8, %rcx vmovss %xmm0, (%rsi,%rdx,4) movq %rcx, 0x8(%rsp) jmp 0x43947 movq 0x38(%r15), %rdx leaq 0x41fdd2(%rip), %rax # 0x463745 movq %r12, 0x28(%rsp) movq %rax, 0x30(%rsp) leaq 0x38(%rsp), %rdi leaq 0x28(%rsp), %rcx callq 0x439e2 movq %r12, %rdi pushq $0xa popq %rsi callq 0xb400 incl %ebp jmp 0x43910 leaq 0x58(%rsp), %rdi callq 0xb4d0 addq $0x258, %rsp # imm = 0x258 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq leaq 0x38(%rsp), %rdi movq %rax, %rbx callq 0xe956 jmp 0x439da jmp 0x439cd jmp 0x439cd leaq 0x58(%rsp), %rdi movq %rax, %rbx callq 0xb4d0 movq %rbx, %rdi callq 0xb3d0
/quesnel[P]baryonyx/lib/src/observer.hpp
baryonyx::itm::solver_functor<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::maximize_tag, baryonyx::itm::default_cost_type<float>>, float, baryonyx::itm::maximize_tag, baryonyx::itm::default_cost_type<float>, baryonyx::none_observer>::store_if_better(baryonyx::bit_array const&, double, long)
inline bool is_better_solution(Float lhs, Float rhs) noexcept { if constexpr (std::is_same_v<Mode, minimize_tag>) return lhs < rhs; else return lhs > rhs; }
vucomisd 0x30(%rdi), %xmm0 jbe 0x43b9a pushq %r14 pushq %rbx pushq %rax movq %rdi, %r14 addq $0x20, %rdi movq %rdx, %rbx vmovsd %xmm0, (%rsp) callq 0x36a44 movq %r14, %rdi callq 0x43c14 vmovsd (%rsp), %xmm1 vmovsd %xmm0, 0x38(%r14) movq %rbx, 0x48(%r14) andl $0x0, 0x50(%r14) vmovsd %xmm1, 0x30(%r14) addq $0x8, %rsp popq %rbx popq %r14 retq nop
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::itm::solver_functor<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::maximize_tag, baryonyx::itm::default_cost_type<float>>, float, baryonyx::itm::maximize_tag, baryonyx::itm::default_cost_type<float>, baryonyx::none_observer>::is_timelimit_reached()
bool is_timelimit_reached() { m_end = std::chrono::steady_clock::now(); return is_time_limit(m_ctx.parameters.time_limit, m_begin, m_end); }
pushq %rbx movq %rdi, %rbx callq 0xb5a0 movq %rax, 0x8(%rbx) vxorpd %xmm2, %xmm2, %xmm2 movq 0x10(%rbx), %rcx subq (%rbx), %rax vmovsd (%rcx), %xmm0 vcvtsi2sd %rax, %xmm1, %xmm1 vdivsd 0x415e83(%rip), %xmm1, %xmm1 # 0x459a80 vcmpnlepd %xmm2, %xmm0, %k1 vcmpltpd %xmm1, %xmm0, %k0 {%k1} kmovd %k0, %eax andb $0x1, %al popq %rbx retq nop
/quesnel[P]baryonyx/lib/src/itm-solver-common.hpp
baryonyx::result baryonyx::itm::optimize_problem<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>>, float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>>(baryonyx::context const&, baryonyx::problem const&)
inline result optimize_problem(const context& ctx, const problem& pb) { result r; if (ctx.start) ctx.start(ctx.parameters); auto constraints{ make_merged_constraints(ctx, pb) }; if (constraints.empty() || pb.vars.values.empty()) { r.status = result_status::success; r.solutions.resize(1); r.solutions.back().value = pb.objective.value; r.strings = pb.strings; r.affected_vars = pb.affected_vars; r.variable_name = pb.vars.names; return r; } random_engine rng(init_random_generator_seed(ctx)); auto variables = length(pb.vars.values); auto cost = Cost(pb.objective, variables); auto cost_constant = pb.objective.value; const auto thread = get_thread_number(ctx); std::vector<optimize_functor<Solver, Float, Mode, Cost>> functors; std::vector<std::thread> pool(thread); best_solution_recorder<Cost, Float, Mode> best_recorder( rng, thread, cost, cost_constant, variables, constraints, ctx.parameters.init_population_size); auto seeds = generate_seed(rng, thread); std::atomic_bool stop_task; stop_task.store(false); for (unsigned i = 0u; i != thread; ++i) functors.emplace_back(ctx, i, seeds[i]); for (unsigned i = 0u; i != thread; ++i) pool[i] = std::thread(std::ref(functors[i]), std::ref(stop_task), std::ref(best_recorder), std::cref(constraints), variables, std::cref(cost), cost_constant); const auto start = std::chrono::steady_clock::now(); auto end = start; do { std::this_thread::sleep_for(std::chrono::seconds{ 1L }); if (ctx.update) { auto call_number = 0L; for (auto i = 0u; i != thread; ++i) call_number += functors[i].m_call_number; int constraints_remaining; long int loop; double value; double duration; best_recorder.get_best( constraints_remaining, value, duration, loop); ctx.update( constraints_remaining, value, loop, duration, call_number); } end = std::chrono::steady_clock::now(); } while (!is_time_limit(ctx.parameters.time_limit, start, end)); stop_task.store(true); for (auto& t : pool) t.join(); r.strings = pb.strings; r.affected_vars = pb.affected_vars; r.variable_name = pb.vars.names; r.variables = variables; r.constraints = length(constraints); const auto& first = best_recorder.get_best(0); if (!first.is_solution()) r.status = result_status::time_limit_reached; else r.status = result_status::success; r.duration = first.duration; r.loop = first.loop; r.remaining_constraints = first.remaining_constraints; switch (ctx.parameters.storage) { case solver_parameters::storage_type::one: { r.solutions.resize(1); convert(first, r.solutions[0], variables); } break; case solver_parameters::storage_type::bound: { r.solutions.resize(2); convert(first, r.solutions[0], variables); convert(best_recorder.get_worst(), r.solutions[1], variables); } break; case solver_parameters::storage_type::five: { r.solutions.resize(5); for (int i = 0; i != 5; ++i) convert(best_recorder.get_best(i), r.solutions[i], variables); } break; } best_recorder.show_population(ctx); if (ctx.finish) ctx.finish(r); return r; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x198, %rsp # imm = 0x198 vxorpd %xmm0, %xmm0, %xmm0 movq %rdx, %r13 movq %rsi, %r15 movq %rdi, %r12 vmovupd %zmm0, 0x58(%rdi) vmovupd %zmm0, 0x40(%rdi) vmovupd %zmm0, (%rdi) movq $0x7fffffff, 0x98(%rdi) # imm = 0x7FFFFFFF movl $0x2, 0xa0(%rdi) cmpq $0x0, 0x128(%rsi) je 0x43c99 leaq 0x118(%r15), %rdi movq %r15, %rsi vzeroupper callq 0x3527e leaq 0x48(%rsp), %rdi movq %r15, %rsi movq %r13, %rdx vzeroupper callq 0x450078 movq 0x48(%rsp), %rax cmpq 0x50(%rsp), %rax je 0x43df8 movq 0xa8(%r13), %rax cmpq 0xb0(%r13), %rax je 0x43df8 movq %r15, %rdi callq 0x353ba movl $0x7fffffff, %ecx # imm = 0x7FFFFFFF xorl %edx, %edx divq %rcx cmpq $0x1, %rdx adcq $0x0, %rdx movq %rdx, 0x40(%rsp) movq 0xb0(%r13), %rax subq 0xa8(%r13), %rax pushq $0xc popq %rcx cqto leaq 0x10(%r13), %rsi idivq %rcx movl %eax, 0x4(%rsp) leaq 0xb8(%rsp), %rdi movl %eax, %edx movq %r12, 0x10(%rsp) callq 0x445b4 vmovsd 0x40(%r13), %xmm0 vmovsd %xmm0, 0x38(%rsp) movq %r15, %rdi callq 0x35447 andq $0x0, 0x70(%rsp) vxorpd %xmm0, %xmm0, %xmm0 movl %eax, %ebp vmovapd %xmm0, 0x60(%rsp) leaq 0xa0(%rsp), %rdi leaq 0xd8(%rsp), %rdx movq %rbp, %rsi callq 0x35462 vmovsd 0x38(%rsp), %xmm0 movl 0xc4(%r15), %eax movl 0x4(%rsp), %r8d subq $0x8, %rsp movl %ebp, %edx leaq 0xe0(%rsp), %rdi leaq 0x48(%rsp), %rsi leaq 0xc0(%rsp), %rcx leaq 0x50(%rsp), %r9 pushq %rax callq 0x447c6 popq %rax popq %rcx leaq 0x30(%rsp), %rdi leaq 0x40(%rsp), %rsi movl %ebp, %edx callq 0x3551c xorl %eax, %eax movb %al, 0x3(%rsp) xorl %ecx, %ecx leaq 0x60(%rsp), %rbx leaq 0x8(%rsp), %r14 xchgb %cl, 0x3(%rsp) leaq 0x90(%r13), %rcx movq %rcx, 0x88(%rsp) movl %eax, 0x8(%rsp) cmpl %ebp, %eax je 0x43e53 movl %eax, %ecx shlq $0x3, %rcx addq 0x30(%rsp), %rcx movq %rbx, %rdi movq %r15, %rsi movq %r14, %rdx callq 0x4482c movl 0x8(%rsp), %eax incl %eax jmp 0x43dcf andl $0x0, 0xa0(%r12) leaq 0x68(%r12), %rdi pushq $0x1 popq %rsi callq 0x35292 vmovsd 0x40(%r13), %xmm0 movq 0x70(%r12), %rax vmovsd %xmm0, -0x8(%rax) movq %r12, %rdi movq %r13, %rsi callq 0x31d28 leaq 0xc0(%r13), %rsi leaq 0x20(%r12), %rdi callq 0x352c2 addq $0x90, %r13 leaq 0x50(%r12), %rdi movq %r13, %rsi callq 0x352ec jmp 0x441ee movq %r13, 0x80(%rsp) movq %r15, %r13 leaq 0x8(%rsp), %r15 leaq 0x98(%rsp), %r14 leaq 0x4(%rsp), %rbx xorl %r12d, %r12d cmpq %rbp, %r12 je 0x43f17 imulq $0xc0, %r12, %rax addq 0x60(%rsp), %rax leaq 0x3(%rsp), %r10 leaq 0xd8(%rsp), %r11 movq %r10, 0x20(%rsp) leaq 0x48(%rsp), %r10 movq %r11, 0x18(%rsp) movq %r10, 0x98(%rsp) movq %rax, 0x28(%rsp) leaq 0xb8(%rsp), %rax movq %rax, 0x90(%rsp) leaq 0x20(%rsp), %rdx leaq 0x38(%rsp), %rax movq %r15, %rdi leaq 0x28(%rsp), %rsi leaq 0x18(%rsp), %rcx movq %r14, %r8 movq %rbx, %r9 pushq %rax leaq 0x98(%rsp), %rax pushq %rax callq 0x44878 popq %rax popq %rcx leaq (,%r12,8), %rdi addq 0xa0(%rsp), %rdi movq %r15, %rsi callq 0x356d6 movq %r15, %rdi callq 0x356f0 incq %r12 jmp 0x43e73 callq 0xb5a0 imulq $0xc0, %rbp, %r15 leaq 0x138(%r13), %r12 leaq 0x8(%rsp), %rbp movq %rax, %rbx movq $0x1, 0x8(%rsp) movq %rbp, %rdi callq 0x356fd cmpq $0x0, 0x148(%r13) je 0x43fac movq 0x60(%rsp), %rax xorl %ecx, %ecx xorl %r14d, %r14d cmpq %rcx, %r15 je 0x43f6d addq 0xb0(%rax,%rcx), %r14 addq $0xc0, %rcx jmp 0x43f57 leaq 0xe0(%rsp), %rdi leaq 0x18(%rsp), %rsi leaq 0x28(%rsp), %rdx leaq 0x20(%rsp), %rcx movq %rbp, %r8 callq 0x4d156 vmovsd 0x28(%rsp), %xmm0 vmovsd 0x20(%rsp), %xmm1 movq 0x8(%rsp), %rdx movl 0x18(%rsp), %esi movq %r12, %rdi movq %r14, %rcx callq 0x35736 callq 0xb5a0 vmovsd (%r13), %xmm0 subq %rbx, %rax vxorpd %xmm1, %xmm1, %xmm1 vucomisd %xmm0, %xmm1 vcvtsi2sd %rax, %xmm2, %xmm1 vdivsd 0x415ab1(%rip), %xmm1, %xmm1 # 0x459a80 jae 0x43f32 vucomisd %xmm0, %xmm1 jbe 0x43f32 movb $0x1, %al xchgb %al, 0x3(%rsp) movq 0xa0(%rsp), %rbx movq 0xa8(%rsp), %r14 movq 0x10(%rsp), %r12 cmpq %r14, %rbx je 0x4400d movq %rbx, %rdi callq 0xb1a0 addq $0x8, %rbx jmp 0x43ffa movq 0x80(%rsp), %rbx movq %r12, %rdi movq %rbx, %rsi callq 0x31d28 addq $0xc0, %rbx leaq 0x20(%r12), %rdi movq %rbx, %rsi callq 0x352c2 leaq 0x50(%r12), %rdi movq 0x88(%rsp), %rsi callq 0x352ec movl 0x4(%rsp), %eax movl %eax, 0x90(%r12) movq 0x50(%rsp), %rax subq 0x48(%rsp), %rax pushq $0x28 popq %rcx cqto xorl %esi, %esi idivq %rcx movq 0x118(%rsp), %rdi movq 0x130(%rsp), %rcx movl %eax, 0x94(%r12) movslq (%rdi), %rax imulq $0x38, %rax, %rax movl 0x30(%rcx,%rax), %edx leaq (%rcx,%rax), %rbx testl %edx, %edx setne %sil leal (%rsi,%rsi,2), %esi movl %esi, 0xa0(%r12) vmovsd 0x18(%rcx,%rax), %xmm0 vmovsd %xmm0, 0x80(%r12) movq 0x28(%rcx,%rax), %rax movq %rax, 0x88(%r12) movl %edx, 0x98(%r12) movl 0xe8(%r13), %eax testl %eax, %eax je 0x44168 cmpl $0x1, %eax je 0x44130 cmpl $0x2, %eax jne 0x44187 leaq 0x68(%r12), %rbx pushq $0x5 popq %rsi movq %rbx, %rdi callq 0x35292 xorl %r14d, %r14d xorl %r15d, %r15d cmpq $0x5, %r15 je 0x44187 movq 0x118(%rsp), %rax movq (%rbx), %rsi movl 0x4(%rsp), %edx movslq (%rax,%r15,4), %rax addq %r14, %rsi imulq $0x38, %rax, %rdi addq 0x130(%rsp), %rdi callq 0x35781 incq %r15 addq $0x20, %r14 jmp 0x440f6 leaq 0x68(%r12), %r14 pushq $0x2 popq %rsi movq %r14, %rdi callq 0x35292 movl 0x4(%rsp), %edx movq (%r14), %rsi movq %rbx, %rdi callq 0x35781 leaq 0xe0(%rsp), %rdi callq 0x4d1d4 movq (%r14), %rsi movq %rax, %rbx addq $0x20, %rsi jmp 0x4417b leaq 0x68(%r12), %r14 pushq $0x1 popq %rsi movq %r14, %rdi callq 0x35292 movq (%r14), %rsi movl 0x4(%rsp), %edx movq %rbx, %rdi callq 0x35781 leaq 0xd8(%rsp), %rdi movq %r13, %rsi callq 0x4492a cmpq $0x0, 0x168(%r13) je 0x441b3 addq $0x158, %r13 # imm = 0x158 movq %r13, %rdi movq %r12, %rsi callq 0x357ea leaq 0x30(%rsp), %rdi callq 0x357fe leaq 0xd8(%rsp), %rdi callq 0x4493e leaq 0xa0(%rsp), %rdi callq 0x35836 leaq 0x60(%rsp), %rdi callq 0x4d2b4 leaq 0xb8(%rsp), %rdi callq 0x4495c leaq 0x48(%rsp), %rdi callq 0x35858 movq %r12, %rax addq $0x198, %rsp # imm = 0x198 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq movq %rax, %rbx jmp 0x4424f movq %rax, %rbx jmp 0x4425c movq %rax, %rbx jmp 0x44269 jmp 0x44233 jmp 0x44224 jmp 0x44242 jmp 0x44242 movq %r12, 0x10(%rsp) movq %rax, %rbx jmp 0x4428a movq %r12, 0x10(%rsp) movq %rax, %rbx jmp 0x44280 jmp 0x44242 jmp 0x44242 jmp 0x44242 jmp 0x44242 jmp 0x44242 movq %rax, %rbx leaq 0x30(%rsp), %rdi callq 0x357fe leaq 0xd8(%rsp), %rdi callq 0x4493e leaq 0xa0(%rsp), %rdi callq 0x35836 leaq 0x60(%rsp), %rdi callq 0x4d2b4 leaq 0xb8(%rsp), %rdi callq 0x4495c leaq 0x48(%rsp), %rdi callq 0x35858 movq 0x10(%rsp), %rdi callq 0xea60 movq %rbx, %rdi callq 0xb3d0
/quesnel[P]baryonyx/lib/src/itm-optimizer-common.hpp
baryonyx::result baryonyx::itm::solve_problem<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>>, float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>>(baryonyx::context const&, baryonyx::problem const&)
inline result solve_problem(const context& ctx, const problem& pb) { if (ctx.start) ctx.start(ctx.parameters); result ret; auto variables = length(pb.vars.values); auto constraints{ make_merged_constraints(ctx, pb) }; if (!constraints.empty() && !pb.vars.values.empty()) { random_engine rng(init_random_generator_seed(ctx)); auto cost = Cost(pb.objective, variables); auto cost_constant = pb.objective.value; switch (ctx.parameters.observer) { case solver_parameters::observer_type::pnm: { using obs = pnm_observer; solver_functor<Solver, Float, Mode, Cost, obs> slv(ctx, rng); ret = slv(constraints, variables, cost, cost_constant); } break; case solver_parameters::observer_type::file: { using obs = file_observer; solver_functor<Solver, Float, Mode, Cost, obs> slv(ctx, rng); ret = slv(constraints, variables, cost, cost_constant); } break; default: { using obs = none_observer; solver_functor<Solver, Float, Mode, Cost, obs> slv(ctx, rng); ret = slv(constraints, variables, cost, cost_constant); break; } } } else { ret.status = result_status::success; ret.solutions.resize(1); ret.solutions.back().value = pb.objective.value; } ret.strings = pb.strings; ret.variable_name = std::move(pb.vars.names); ret.affected_vars = std::move(pb.affected_vars); ret.variables = variables; ret.constraints = length(constraints); if (ctx.finish) ctx.finish(ret); return ret; }
pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x140, %rsp # imm = 0x140 cmpq $0x0, 0x128(%rsi) movq %rdx, %r15 movq %rsi, %r14 movq %rdi, %rbx je 0x442ce leaq 0x118(%r14), %rdi movq %r14, %rsi callq 0x3527e vxorps %xmm0, %xmm0, %xmm0 vmovups %zmm0, 0x58(%rbx) vmovups %zmm0, 0x40(%rbx) vmovups %zmm0, (%rbx) movq $0x7fffffff, 0x98(%rbx) # imm = 0x7FFFFFFF movl $0x2, 0xa0(%rbx) movq 0xb0(%r15), %rax subq 0xa8(%r15), %rax pushq $0xc popq %rcx cqto idivq %rcx movq %rax, %r12 leaq 0x8(%rsp), %rdi movq %r14, %rsi movq %r15, %rdx vzeroupper callq 0x450078 movq 0x8(%rsp), %rax cmpq 0x10(%rsp), %rax je 0x443f7 movq 0xa8(%r15), %rax cmpq 0xb0(%r15), %rax je 0x443f7 movq %r14, %rdi callq 0x353ba movl $0x7fffffff, %ecx # imm = 0x7FFFFFFF xorl %edx, %edx leaq 0x10(%r15), %rsi divq %rcx cmpq $0x1, %rdx adcq $0x0, %rdx movq %rdx, (%rsp) leaq 0x20(%rsp), %rdi movl %r12d, %edx callq 0x445b4 vmovsd 0x40(%r15), %xmm0 movl 0xe4(%r14), %eax vxorps %xmm1, %xmm1, %xmm1 leaq 0x40(%rsp), %rsi cmpl $0x1, %eax je 0x4441e cmpl $0x2, %eax jne 0x4446d movabsq $-0x10000000000000, %r9 # imm = 0xFFF0000000000000 vmovaps %xmm1, (%rsi) movq %r14, 0x10(%rsi) movq %rsp, %rax movq %rax, 0x18(%rsi) vmovaps %xmm1, 0x20(%rsi) movq %r9, 0x30(%rsi) andq $0x0, 0x48(%rsi) vmovups %xmm1, 0x38(%rsi) movl $0x7fffffff, 0x50(%rsi) # imm = 0x7FFFFFFF leaq 0x98(%rsp), %rdi leaq 0x8(%rsp), %rdx leaq 0x20(%rsp), %r8 movl %r12d, %ecx callq 0x4d9ba jmp 0x444ba andl $0x0, 0xa0(%rbx) leaq 0x68(%rbx), %rdi pushq $0x1 popq %rsi callq 0x35292 vmovsd 0x40(%r15), %xmm0 movq 0x70(%rbx), %rax vmovsd %xmm0, -0x8(%rax) jmp 0x444e9 movabsq $-0x10000000000000, %r9 # imm = 0xFFF0000000000000 vmovaps %xmm1, (%rsi) movq %r14, 0x10(%rsi) movq %rsp, %rax movq %rax, 0x18(%rsi) vmovaps %xmm1, 0x20(%rsi) movq %r9, 0x30(%rsi) andq $0x0, 0x48(%rsi) vmovups %xmm1, 0x38(%rsi) movl $0x7fffffff, 0x50(%rsi) # imm = 0x7FFFFFFF leaq 0x98(%rsp), %rdi leaq 0x8(%rsp), %rdx leaq 0x20(%rsp), %r8 movl %r12d, %ecx callq 0x4d2dc jmp 0x444ba movabsq $-0x10000000000000, %r9 # imm = 0xFFF0000000000000 vmovaps %xmm1, (%rsi) movq %r14, 0x10(%rsi) movq %rsp, %rax movq %rax, 0x18(%rsi) vmovaps %xmm1, 0x20(%rsi) movq %r9, 0x30(%rsi) andq $0x0, 0x48(%rsi) vmovups %xmm1, 0x38(%rsi) movl $0x7fffffff, 0x50(%rsi) # imm = 0x7FFFFFFF leaq 0x98(%rsp), %rdi leaq 0x8(%rsp), %rdx leaq 0x20(%rsp), %r8 movl %r12d, %ecx callq 0x4e098 leaq 0x98(%rsp), %r13 movq %rbx, %rdi movq %r13, %rsi callq 0x41d9e movq %r13, %rdi callq 0xea60 leaq 0x68(%rsp), %rdi callq 0x357fe leaq 0x20(%rsp), %rdi callq 0x4495c leaq 0x90(%r15), %r13 movq %rbx, %rdi movq %r15, %rsi callq 0x31d28 leaq 0x50(%rbx), %rdi movq %r13, %rsi callq 0x352ec addq $0xc0, %r15 leaq 0x20(%rbx), %rdi movq %r15, %rsi callq 0x352c2 movq 0x10(%rsp), %rax movl %r12d, 0x90(%rbx) subq 0x8(%rsp), %rax pushq $0x28 popq %rcx cqto idivq %rcx movl %eax, 0x94(%rbx) cmpq $0x0, 0x168(%r14) je 0x44555 addq $0x158, %r14 # imm = 0x158 movq %r14, %rdi movq %rbx, %rsi callq 0x357ea leaq 0x8(%rsp), %rdi callq 0x35858 movq %rbx, %rax addq $0x140, %rsp # imm = 0x140 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 retq jmp 0x44577 jmp 0x44577 leaq 0x68(%rsp), %rdi movq %rax, %r14 callq 0x357fe leaq 0x20(%rsp), %rdi callq 0x4495c jmp 0x4459a jmp 0x44597 movq %rax, %r14 jmp 0x445a4 movq %rax, %r14 leaq 0x8(%rsp), %rdi callq 0x35858 movq %rbx, %rdi callq 0xea60 movq %r14, %rdi callq 0xb3d0
/quesnel[P]baryonyx/lib/src/itm-solver-common.hpp
baryonyx::itm::quadratic_cost_type<float>::quadratic_cost_type(baryonyx::objective_function const&, int)
quadratic_cost_type(const objective_function& obj_, int n) : obj(obj_) , linear_elements(std::make_unique<Float[]>(n)) , quadratic_elements( std::make_unique<quad[]>(2 * obj.qelements.size() + 1)) , indices(std::make_unique<int[]>(n + 1)) { for (int i = 0, e = length(obj.elements); i != e; ++i) { bx_ensures(0 <= obj.elements[i].variable_index && obj.elements[i].variable_index < n); linear_elements[obj.elements[i].variable_index] += static_cast<Float>(obj.elements[i].factor); } indices[0] = 0; for (int var = 0; var != n; ++var) { indices[var + 1] = indices[var]; for (int i = 0, e = length(obj.qelements); i != e; ++i) { bx_ensures(0 <= obj.qelements[i].variable_index_a && obj.qelements[i].variable_index_a < n); bx_ensures(0 <= obj.qelements[i].variable_index_b && obj.qelements[i].variable_index_b < n); if (var == obj.qelements[i].variable_index_a || var == obj.qelements[i].variable_index_b) ++indices[var + 1]; } } for (int id = 0, var = 0; var != n; ++var) { for (int i = 0, e = length(obj.qelements); i != e; ++i) { const bool is_a = obj.qelements[i].variable_index_a == var; const bool is_b = obj.qelements[i].variable_index_b == var; if (is_a || is_b) { quadratic_elements[id].factor = static_cast<Float>(obj.qelements[i].factor); quadratic_elements[id].id = is_a ? obj.qelements[i].variable_index_b : obj.qelements[i].variable_index_a; ++id; } } } }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx pushq %rax movq %rsi, (%rdi) leaq 0x8(%rdi), %r15 movslq %edx, %rsi movq %rdi, %r13 movl %edx, %ebx movq %r15, %rdi callq 0x35bd8 movq (%r13), %rax leaq 0x10(%r13), %r14 movq 0x20(%rax), %rsi subq 0x18(%rax), %rsi sarq $0x3, %rsi orq $0x1, %rsi movq %r14, %rdi callq 0x4497f leal 0x1(%rbx), %eax leaq 0x18(%r13), %r12 movslq %eax, %rsi movq %r12, %rdi callq 0x28eb6 movq (%r13), %rax movq 0x8(%r13), %rdx movabsq $0xffffffff0, %rcx # imm = 0xFFFFFFFF0 xorl %r8d, %r8d movq (%rax), %rsi movq 0x8(%rax), %rdi subq %rsi, %rdi andq %rcx, %rdi cmpq %r8, %rdi je 0x4465e movslq 0x8(%rsi,%r8), %r9 testq %r9, %r9 js 0x44785 cmpl %ebx, %r9d jge 0x44785 vcvtsd2ss (%rsi,%r8), %xmm1, %xmm0 addq $0x10, %r8 vaddss (%rdx,%r9,4), %xmm0, %xmm0 vmovss %xmm0, (%rdx,%r9,4) jmp 0x4462a movq (%r12), %rdx movl %ebx, %esi xorl %edi, %edi xorl %r8d, %r8d andl $0x0, (%rdx) cmpq %rsi, %r8 je 0x446d9 movl %edi, 0x4(%rdx,%r8,4) leaq 0x1(%r8), %r9 xorl %r15d, %r15d movq 0x18(%rax), %r10 movq 0x20(%rax), %r11 subq %r10, %r11 andq %rcx, %r11 cmpq %r15, %r11 je 0x446d4 movslq 0x8(%r10,%r15), %r12 testq %r12, %r12 js 0x44743 cmpl %ebx, %r12d jge 0x44743 movslq 0xc(%r10,%r15), %r13 testq %r13, %r13 js 0x44764 cmpl %ebx, %r13d jae 0x44764 cmpq %r12, %r8 je 0x446c8 cmpq %r13, %r8 jne 0x446ce incl %edi movl %edi, (%rdx,%r9,4) addq $0x10, %r15 jmp 0x4468b movq %r9, %r8 jmp 0x4466c xorl %edx, %edx xorl %esi, %esi cmpl %ebx, %esi je 0x44734 movq 0x18(%rax), %rdi movq 0x20(%rax), %r8 movq (%r14), %r9 xorl %r10d, %r10d subq %rdi, %r8 andq %rcx, %r8 cmpq %r10, %r8 je 0x44730 movl 0x8(%rdi,%r10), %r11d movl 0xc(%rdi,%r10), %ebp cmpl %esi, %r11d je 0x4470d cmpl %esi, %ebp jne 0x4472a vcvtsd2ss (%rdi,%r10), %xmm1, %xmm0 cmpl %esi, %r11d movslq %edx, %rdx cmovnel %r11d, %ebp vmovss %xmm0, (%r9,%rdx,8) movl %ebp, 0x4(%r9,%rdx,8) incl %edx addq $0x10, %r10 jmp 0x446f5 incl %esi jmp 0x446dd addq $0x8, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq leaq 0x413ce0(%rip), %rdi # 0x45842a leaq 0x415f41(%rip), %rsi # 0x45a692 leaq 0x415834(%rip), %rdx # 0x459f8c leaq 0x415f83(%rip), %rcx # 0x45a6e2 callq 0x2813f leaq 0x413cbf(%rip), %rdi # 0x45842a leaq 0x415f75(%rip), %rsi # 0x45a6e7 leaq 0x415813(%rip), %rdx # 0x459f8c leaq 0x415fb7(%rip), %rcx # 0x45a737 callq 0x2813f leaq 0x413c9e(%rip), %rdi # 0x45842a leaq 0x415eb0(%rip), %rsi # 0x45a643 leaq 0x4157f2(%rip), %rdx # 0x459f8c leaq 0x415eec(%rip), %rcx # 0x45a68d callq 0x2813f movq %r14, %rdi movq %rax, %rbx callq 0x449c0 jmp 0x447b6 movq %rax, %rbx movq %r15, %rdi callq 0x35c1a movq %rbx, %rdi callq 0xb3d0
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::itm::storage<baryonyx::itm::quadratic_cost_type<float>, baryonyx::itm::maximize_tag>::storage(std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>&, baryonyx::itm::quadratic_cost_type<float> const&, double, int, int, std::vector<baryonyx::itm::merged_constraint, std::allocator<baryonyx::itm::merged_constraint>> const&)
storage(random_engine& rng, const Cost& costs_, const double cost_constant_, const int population_size, const int variables, const std::vector<merged_constraint>& constraints_) : m_indices(population_size) , m_data(population_size) , m_bastert(variables) , m_random(variables) , costs(costs_) , cost_constant(cost_constant_) , m_size(population_size) { for (auto& elem : m_data) elem.x = bit_array(variables); init_with_bastert<Cost, Mode>(m_bastert, costs_, variables, 0); for (int i = 0, e = m_size / 2; i != e; ++i) { m_data[i].x = m_bastert; std::bernoulli_distribution dist( std::clamp(static_cast<double>(i) / (5 * e), 0.0, 1.0)); for (int v = 0; v != variables; ++v) if (dist(rng)) m_data[i].x.invert(v); } for (int i = m_size / 2, e = m_size; i + 1 < e; i += 2) { init_with_random(m_data[i].x, rng, variables, 0.2); init_with_random(m_data[i + 1].x, rng, variables, 0.8); init_with_pre_solve<Cost, Mode>( m_data[i].x, m_data[i + 1].x, rng, costs_, constraints_, std::clamp(static_cast<double>(i) / (5 * e), 0.0, 1.0)); } for (int i = 0, e = m_size; i != e; ++i) { m_data[i].make_hash(); m_data[i].value = costs.results(m_data[i].x, cost_constant_); m_data[i].remaining_constraints = 0; for (int k = 0, end_k = length(constraints_); k != end_k; ++k) { int sum = 0; for (const auto& elem : constraints_[k].elements) { if (m_data[i].x[elem.variable_index]) sum += elem.factor; } if (!(constraints_[k].min <= sum && sum <= constraints_[k].max)) ++m_data[i].remaining_constraints; } } std::iota(std::begin(m_indices), std::end(m_indices), 0); sort(); }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x68, %rsp vmovsd %xmm0, 0x40(%rsp) vxorpd %xmm0, %xmm0, %xmm0 movq %rdx, 0x18(%rsp) movq %rdi, %r15 movslq %ecx, %r12 leaq 0x58(%rsp), %rdx movq %rsi, %r13 movq %r9, 0x28(%rsp) movl %r8d, %ebp movl %ecx, %ebx vmovupd %ymm0, 0x18(%rdi) vmovupd %ymm0, (%rdi) addq $0x38, %rdi movq %r12, %rsi movq %rdi, 0x48(%rsp) vzeroupper callq 0x3140c leaq 0x50(%r15), %r14 leaq 0x58(%rsp), %rdx movq %r14, %rdi movq %r12, %rsi callq 0x36194 leaq 0x68(%r15), %rdi movl %ebp, %esi movq %rdi, 0x10(%rsp) callq 0x368ae leaq 0x78(%r15), %rdi movl %ebp, %esi callq 0x368ae vmovsd 0x40(%rsp), %xmm0 movq 0x18(%rsp), %rax movq %r15, 0x8(%rsp) leaq 0x58(%rsp), %r12 movq %rax, 0x88(%r15) vmovsd %xmm0, 0x90(%r15) movl %ebx, 0x98(%r15) movq 0x50(%r15), %rbx movq 0x58(%r15), %r15 cmpq %r15, %rbx je 0x44ac7 movq %r12, %rdi movl %ebp, %esi callq 0x368ae movq %rbx, %rdi movq %r12, %rsi callq 0x3696c leaq 0x60(%rsp), %rdi callq 0x357fe addq $0x38, %rbx jmp 0x44a9d movq 0x10(%rsp), %rdi movq 0x18(%rsp), %rsi xorl %r15d, %r15d movl %ebp, %edx xorl %ecx, %ecx callq 0x44de5 movq 0x8(%rsp), %rax movl 0x98(%rax), %eax pushq $0x2 popq %rcx cltd idivl %ecx movq %rax, 0x20(%rsp) leal (%rax,%rax,4), %eax vcvtsi2sd %eax, %xmm1, %xmm0 vmovsd %xmm0, 0x50(%rsp) cmpq 0x20(%rsp), %r15 je 0x44b79 movq (%r14), %rdi imulq $0x38, %r15, %r12 addq %r12, %rdi movq 0x10(%rsp), %rsi callq 0x36a44 vcvtsi2sd %r15d, %xmm3, %xmm0 vdivsd 0x50(%rsp), %xmm0, %xmm0 vmovsd 0x40f50a(%rip), %xmm1 # 0x454038 xorl %ebx, %ebx vminsd %xmm0, %xmm1, %xmm2 vxorpd %xmm1, %xmm1, %xmm1 vcmpltsd %xmm1, %xmm0, %k1 vmovsd %xmm1, %xmm2, %xmm2 {%k1} vmovapd %xmm2, 0x30(%rsp) cmpl %ebx, %ebp je 0x44b74 movq %r13, %rdi callq 0x36ac3 vmovapd 0x30(%rsp), %xmm1 vucomisd %xmm0, %xmm1 jbe 0x44b70 movq (%r14), %rdi movl %ebx, %esi addq %r12, %rdi callq 0x3626e incl %ebx jmp 0x44b4b incq %r15 jmp 0x44b00 movq 0x8(%rsp), %rax movslq 0x98(%rax), %rsi movl %esi, %eax cltd pushq $0x2 popq %rcx idivl %ecx leal (%rsi,%rsi,4), %ecx movq %rsi, 0x30(%rsp) vcvtsi2sd %ecx, %xmm3, %xmm0 vmovsd %xmm0, 0x10(%rsp) movslq %eax, %r12 movl %eax, %r15d imulq $0x38, %r12, %rbx incq %r12 cmpq 0x30(%rsp), %r12 jge 0x44c3f vmovsd 0x414ec9(%rip), %xmm0 # 0x459a88 movq (%r14), %rdi movq %r13, %rsi movl %ebp, %edx addq %rbx, %rdi callq 0x362ac vmovsd 0x414eb9(%rip), %xmm0 # 0x459a90 movq (%r14), %rax movq %r13, %rsi movl %ebp, %edx leaq 0x38(%rax,%rbx), %rdi callq 0x362ac vcvtsi2sd %r15d, %xmm3, %xmm0 vdivsd 0x10(%rsp), %xmm0, %xmm1 vmovsd 0x40f43c(%rip), %xmm0 # 0x454038 movq (%r14), %rdi movq 0x18(%rsp), %rcx movq 0x28(%rsp), %r8 vxorpd %xmm2, %xmm2, %xmm2 movq %r13, %rdx leaq 0x38(%rdi,%rbx), %rsi addq %rbx, %rdi vcmpltsd %xmm2, %xmm1, %k1 vminsd %xmm1, %xmm0, %xmm0 vmovsd %xmm2, %xmm0, %xmm0 {%k1} callq 0x44e5a addl $0x2, %r15d addq $0x70, %rbx addq $0x2, %r12 jmp 0x44bac movq 0x8(%rsp), %rax movl 0x98(%rax), %eax movq %rax, 0x20(%rsp) xorl %eax, %eax cmpq 0x20(%rsp), %rax je 0x44d36 movq 0x8(%rsp), %rbx imulq $0x38, %rax, %rbp movq %rax, 0x10(%rsp) movq 0x50(%rbx), %rdi addq %rbp, %rdi callq 0x365b4 vmovsd 0x40(%rsp), %xmm0 movq 0x50(%rbx), %rsi movq 0x88(%rbx), %rdi addq %rbp, %rsi callq 0x45118 movq 0x50(%rbx), %rax vmovsd %xmm0, 0x10(%rax,%rbp) andl $0x0, 0x30(%rax,%rbp) movq 0x28(%rsp), %rax movq (%rax), %rcx movq 0x8(%rax), %rax subq %rcx, %rax cqto pushq $0x28 popq %rsi idivq %rsi movl %eax, %eax movq %rax, 0x18(%rsp) xorl %eax, %eax cmpq 0x18(%rsp), %rax je 0x44d29 imulq $0x28, %rax, %r12 movq %rax, 0x30(%rsp) xorl %r15d, %r15d movq (%rcx,%r12), %r13 movq 0x8(%rcx,%r12), %rbx cmpq %rbx, %r13 je 0x44cff movq (%r14), %rdi movl 0x4(%r13), %esi addq %rbp, %rdi callq 0x3664a testl %eax, %eax je 0x44cf6 movl (%r13), %eax addl %eax, %r15d addq $0x8, %r13 jmp 0x44cda movq 0x28(%rsp), %rax movq (%rax), %rcx cmpl %r15d, 0x18(%rcx,%r12) jg 0x44d18 addq %rcx, %r12 cmpl 0x1c(%r12), %r15d jle 0x44d1f movq (%r14), %rax incl 0x30(%rax,%rbp) movq 0x30(%rsp), %rax incq %rax jmp 0x44cbe movq 0x10(%rsp), %rax incq %rax jmp 0x44c51 movq 0x8(%rsp), %rdi xorl %edx, %edx movq 0x38(%rdi), %rax movq 0x40(%rdi), %rcx cmpq %rcx, %rax je 0x44d54 movl %edx, (%rax) incl %edx addq $0x4, %rax jmp 0x44d45 callq 0x451fc addq $0x68, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq movq %rax, %rbx jmp 0x44d8f movq %rax, %rbx jmp 0x44d9b movq %rax, %rbx jmp 0x44da3 jmp 0x44d7b jmp 0x44d7b movq 0x8(%rsp), %r15 movq %rax, %rbx leaq 0x80(%r15), %rdi callq 0x357fe addq $0x70, %r15 movq %r15, %rdi callq 0x357fe movq %r14, %rdi callq 0x36742 movq 0x48(%rsp), %rdi callq 0x26a34 movq %rbx, %rdi callq 0xb3d0 nop
/quesnel[P]baryonyx/lib/src/itm-optimizer-common.hpp
void baryonyx::itm::init_with_bastert<baryonyx::itm::quadratic_cost_type<float>, baryonyx::itm::maximize_tag>(baryonyx::bit_array&, baryonyx::itm::quadratic_cost_type<float> const&, int, int)
void init_with_bastert(bit_array& x, const Cost& c, const int variables, const int value_if_0) noexcept { for (int i = 0; i != variables; ++i) if (init_x<Mode>(c[i], value_if_0)) x.set(i); else x.unset(i); }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx pushq %rax movl %ecx, %ebx movl %edx, %ebp movq %rsi, %r14 movq %rdi, %r15 xorl %r12d, %r12d cmpl %r12d, %ebp je 0x44e4b testl %ebx, %ebx movq %r14, %rdi movl %r12d, %esi setne %r13b callq 0x452d8 vxorps %xmm1, %xmm1, %xmm1 vucomiss %xmm1, %xmm0 setnp %cl sete %al vucomiss %xmm1, %xmm0 ja 0x44e3b andb %cl, %al andb %al, %r13b jne 0x44e3b movq %r15, %rdi movl %r12d, %esi callq 0x36a06 jmp 0x44e46 movq %r15, %rdi movl %r12d, %esi callq 0x369c8 incl %r12d jmp 0x44dfd addq $0x8, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq
/quesnel[P]baryonyx/lib/src/itm-common.hpp
void baryonyx::itm::init_with_pre_solve<baryonyx::itm::quadratic_cost_type<float>, baryonyx::itm::maximize_tag>(baryonyx::bit_array&, baryonyx::bit_array&, std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>&, baryonyx::itm::quadratic_cost_type<float> const&, std::vector<baryonyx::itm::merged_constraint, std::allocator<baryonyx::itm::merged_constraint>> const&, double)
void init_with_pre_solve(bit_array& x_pessimistic, bit_array& x_optimistic, random_engine& rng, const Cost& c, const std::vector<merged_constraint>& constraints, const double init_random) noexcept { int max_length = 0; for (const auto& cst : constraints) if (length(cst.elements) > max_length) max_length = length(cst.elements); struct reduced_cost { float value; int factor; int id; }; std::vector<reduced_cost> R(max_length); std::bernoulli_distribution dist(init_random); for (const auto& cst : constraints) { if (!dist(rng)) continue; R.resize(cst.elements.size()); const int r_size = length(cst.elements); for (int i = 0; i != r_size; ++i) { R[i].value = static_cast<float>(c[cst.elements[i].variable_index]); R[i].factor = cst.elements[i].factor; R[i].id = cst.elements[i].variable_index; } std::shuffle(std::begin(R), std::end(R), rng); std::sort( std::begin(R), std::end(R), [](const auto& lhs, const auto& rhs) { return is_better_solution<Mode>(lhs.value, rhs.value); }); if (!x_pessimistic.empty()) { int sum = 0; int best = -2; for (int i = -1; i < r_size; ++i) { if (cst.min <= sum && sum <= cst.max) { best = i; break; } if (i + 1 < r_size) sum += R[i + 1].factor; } int i = 0; for (; i <= best; ++i) x_pessimistic.set(R[i].id); for (; i != r_size; ++i) { x_pessimistic.unset(R[i].id); } } if (!x_optimistic.empty()) { int sum = 0; int best = -2; for (int i = -1; i < r_size; ++i) { if (cst.min <= sum && sum <= cst.max) best = i; if (best != -2 && i + 1 < r_size && stop_iterating<Mode>(R[i + 1].value)) break; if (i + 1 < r_size) sum += R[i + 1].factor; } int i = 0; for (; i <= best; ++i) x_optimistic.set(R[i].id); for (; i != r_size; ++i) x_optimistic.unset(R[i].id); } } }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x58, %rsp movq %rcx, 0x30(%rsp) movq (%r8), %rax movq 0x8(%r8), %rcx movq %rdx, %r12 vmovsd %xmm0, 0x48(%rsp) movq %r8, %r13 xorl %edx, %edx movq %rsi, 0x28(%rsp) movq %rdi, 0x20(%rsp) cmpq %rcx, %rax je 0x44ea9 movq 0x8(%rax), %rsi subq (%rax), %rsi shrq $0x3, %rsi cmpl %esi, %edx cmovgl %edx, %esi addq $0x28, %rax movl %esi, %edx jmp 0x44e8c movl %edx, %esi leaq 0x8(%rsp), %rdi leaq 0x7(%rsp), %rdx callq 0x45306 movq 0x8(%r13), %rax movq (%r13), %rbp movq 0x30(%rsp), %r13 movq %r12, 0x38(%rsp) movq %rax, 0x50(%rsp) cmpq 0x50(%rsp), %rbp je 0x450f5 movq %r12, %rdi callq 0x36ac3 vmovsd 0x48(%rsp), %xmm1 vucomisd %xmm0, %xmm1 jbe 0x450ec movq 0x8(%rbp), %rsi subq (%rbp), %rsi sarq $0x3, %rsi leaq 0x8(%rsp), %rdi callq 0x4535a movq (%rbp), %rax movq 0x8(%rbp), %rdx movl $0x2003, %ecx # imm = 0x2003 subq %rax, %rdx bextrq %rcx, %rdx, %r14 movq %rdx, 0x40(%rsp) pushq $0x4 popq %rbx xorl %r15d, %r15d cmpq %r15, %r14 je 0x44f5c movl 0x4(%rax,%r15,8), %esi movq %r13, %rdi callq 0x452d8 movq 0x8(%rsp), %rcx vmovss %xmm0, -0x4(%rcx,%rbx) movq (%rbp), %rax movq (%rax,%r15,8), %rdx incq %r15 movq %rdx, (%rcx,%rbx) addq $0xc, %rbx jmp 0x44f2a movq 0x8(%rsp), %rdi movq 0x10(%rsp), %rsi movq %r12, %rdx callq 0x45392 movq 0x8(%rsp), %rdi movq 0x10(%rsp), %rsi callq 0x457f5 movq 0x20(%rsp), %rax cmpq $0x0, 0x8(%rax) je 0x45022 movq 0x40(%rsp), %rcx movq 0x8(%rsp), %rax xorl %esi, %esi shrq $0x3, %rcx addq $0x4, %rax movslq %ecx, %rdx pushq $-0x1 popq %rcx imulq $0xc, %rcx, %rdi addq %rax, %rdi cmpq %rdx, %rcx jge 0x44fcd cmpl %esi, 0x18(%rbp) jg 0x44fbd cmpl 0x1c(%rbp), %esi jle 0x44fd0 incq %rcx addq $0xc, %rdi cmpq %rdx, %rcx jge 0x44fae addl (%rdi), %esi jmp 0x44fa7 pushq $-0x2 popq %rcx movslq %ecx, %r15 movq %r14, %r13 pushq $0x8 popq %rbx xorl %r12d, %r12d cmpq %r15, %r12 jg 0x44fff movq 0x8(%rsp), %rax movq 0x20(%rsp), %rdi movl (%rax,%rbx), %esi callq 0x369c8 incq %r12 addq $0xc, %rbx decq %r13 jmp 0x44fdc movq 0x38(%rsp), %r12 subq $0x1, %r13 jb 0x45022 movq 0x8(%rsp), %rax movq 0x20(%rsp), %rdi movl (%rax,%rbx), %esi callq 0x36a06 addq $0xc, %rbx jmp 0x45004 movq 0x28(%rsp), %rax movq 0x30(%rsp), %r13 cmpq $0x0, 0x8(%rax) je 0x450ec movq 0x40(%rsp), %rcx movq 0x8(%rsp), %rax xorl %edx, %edx shrq $0x3, %rcx addq $0xc, %rax movslq %ecx, %rcx pushq $-0x1 popq %rsi pushq $-0x2 popq %rdi imulq $0xc, %rsi, %r8 addq %rax, %r8 movl %edi, %r9d cmpq %rcx, %rsi jge 0x4509d cmpl 0x1c(%rbp), %edx movl %esi, %edi cmovgl %r9d, %edi cmpl %edx, 0x18(%rbp) cmovgl %r9d, %edi incq %rsi cmpl $-0x2, %edi je 0x4508b cmpq %rcx, %rsi jge 0x4508b vxorpd %xmm0, %xmm0, %xmm0 vucomiss (%r8), %xmm0 ja 0x4509a addq $0xc, %r8 cmpq %rcx, %rsi jge 0x4505b addl -0x8(%r8), %edx jmp 0x45054 movl %edi, %r9d movslq %r9d, %r15 pushq $0x8 popq %rbx xorl %r12d, %r12d cmpq %r15, %r12 jg 0x450c9 movq 0x8(%rsp), %rax movq 0x28(%rsp), %rdi movl (%rax,%rbx), %esi callq 0x369c8 incq %r12 addq $0xc, %rbx decq %r14 jmp 0x450a6 movq 0x38(%rsp), %r12 subq $0x1, %r14 jb 0x450ec movq 0x8(%rsp), %rax movq 0x28(%rsp), %rdi movl (%rax,%rbx), %esi callq 0x36a06 addq $0xc, %rbx jmp 0x450ce addq $0x28, %rbp jmp 0x44ed1 leaq 0x8(%rsp), %rdi callq 0x4559e addq $0x58, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq jmp 0x45110 movq %rax, %rdi callq 0xeb9f
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::itm::storage<baryonyx::itm::quadratic_cost_type<float>, baryonyx::itm::maximize_tag>::sort()
void sort() noexcept { m_indices_writer lock{ m_indices_mutex }; std::sort( std::begin(m_indices), std::end(m_indices), [this](int i1, int i2) { const int cst_1 = this->m_data[i1].remaining_constraints; const int cst_2 = this->m_data[i2].remaining_constraints; const double value_1 = this->m_data[i1].value; const double value_2 = this->m_data[i2].value; if (cst_1 < cst_2) return true; if (cst_1 == cst_2) return is_better_solution<Mode>(value_1, value_2); return false; }); #ifdef BARYONYX_ENABLE_DEBUG to_log(stdout, 3u, "- Solutions init population:\n"); for (int i = 0; i != m_size; ++i) { to_log(stdout, 5u, "- {} id {} value {} constraint {} hash {}\n", i, m_indices[i], m_data[m_indices[i]].value, m_data[m_indices[i]].remaining_constraints, m_data[m_indices[i]].hash); } #endif }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x18, %rsp movq %rdi, %rbx leaq 0x8(%rsp), %rdi movq %rbx, %rsi callq 0x377e6 movq 0x38(%rbx), %rdi movq 0x40(%rbx), %rsi movq %rbx, %rdx callq 0x45d73 movq 0x5f7d97(%rip), %r13 # 0x63cfc8 movq (%r13), %rdi leaq 0x414e5c(%rip), %rcx # 0x45a098 pushq $0x3 popq %rsi pushq $0x1d popq %rdx callq 0x377fc leaq 0x414e68(%rip), %r14 # 0x45a0b6 xorl %eax, %eax pushq $0x5 popq %rbp pushq $0x2a popq %r15 leaq 0x4(%rsp), %r12 movl %eax, 0x4(%rsp) cmpl 0x98(%rbx), %eax je 0x452b5 movq 0x38(%rbx), %rcx cltq movq 0x50(%rbx), %rdx movq (%r13), %rdi leaq (%rcx,%rax,4), %r9 movslq (%r9), %rax imulq $0x38, %rax, %rax leaq 0x10(%rdx,%rax), %r10 leaq 0x30(%rdx,%rax), %r11 leaq 0x20(%rdx,%rax), %rax subq $0x8, %rsp movq %r15, %rdx movl %ebp, %esi movq %r14, %rcx movq %r12, %r8 pushq %rax pushq %r11 pushq %r10 callq 0x3783f addq $0x20, %rsp movl 0x4(%rsp), %eax incl %eax jmp 0x4525c leaq 0x8(%rsp), %rdi callq 0x378b4 addq $0x18, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq jmp 0x452d0 movq %rax, %rdi callq 0xeb9f
/quesnel[P]baryonyx/lib/src/itm-optimizer-common.hpp
baryonyx::itm::optimize_functor<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>>, float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>>::operator()(std::atomic<bool> const&, baryonyx::itm::best_solution_recorder<baryonyx::itm::quadratic_cost_type<float>, float, baryonyx::itm::maximize_tag>&, std::vector<baryonyx::itm::merged_constraint, std::allocator<baryonyx::itm::merged_constraint>> const&, int, baryonyx::itm::quadratic_cost_type<float> const&, double)
void operator()(const std::atomic_bool& stop_task, best_solution_recorder<Cost, Float, Mode>& best_recorder, const std::vector<merged_constraint>& constraints, int variables, const Cost& original_costs, double cost_constant) { bit_array x(variables); auto& p = m_ctx.parameters; auto norm_costs = normalize_costs<Float, Cost>( m_ctx, original_costs, m_local_ctx.rng, variables); const auto kappa_step = static_cast<Float>(p.kappa_step); const auto kappa_max = static_cast<Float>(p.kappa_max); const auto alpha = static_cast<Float>(p.alpha); const auto theta = static_cast<Float>(p.theta); const auto delta = p.delta < 0 ? compute_delta<Float, Cost>(m_ctx, norm_costs, theta, variables) : static_cast<Float>(p.delta); const auto pushing_k_factor = static_cast<Float>(p.pushing_k_factor); const auto pushing_objective_amplifier = static_cast<Float>(p.pushing_objective_amplifier); const auto w_limit = static_cast<long int>(p.w); Solver slv(m_local_ctx.rng, length(constraints), variables, norm_costs, constraints); compute_order compute(p.order, variables); bool is_a_solution = false; while (!stop_task.load()) { ++m_call_number; const auto kappa_start = static_cast<Float>(best_recorder.reinit( m_local_ctx, is_a_solution, p.kappa_min, p.kappa_max, x)); auto kappa = kappa_start; compute.init(slv, x); auto best_remaining = INT_MAX; is_a_solution = false; for (long int i = 0; !stop_task.load() && i != p.limit; ++i) { auto remaining = compute.run(slv, x, m_local_ctx.rng, kappa, delta, theta); if (remaining == 0) { best_recorder.try_update( m_local_ctx, x, original_costs.results(x, cost_constant), i); best_remaining = 0; is_a_solution = true; break; } else { best_remaining = std::min(remaining, best_remaining); } if (i > w_limit) kappa += kappa_step * std::pow(static_cast<Float>(remaining) / static_cast<Float>(slv.m), alpha); if (kappa > kappa_max) break; } if (best_remaining > 0) { best_recorder.try_advance( m_local_ctx, x, best_remaining, p.limit); continue; } for (int push = 0; !stop_task.load() && push < p.pushes_limit; ++push) { auto remaining = compute.push_and_run(slv, x, m_local_ctx.rng, pushing_k_factor, delta, theta, pushing_objective_amplifier); if (remaining == 0) { best_recorder.try_update( m_local_ctx, x, original_costs.results(x, cost_constant), -push * p.pushing_iteration_limit - 1); is_a_solution = true; } kappa = kappa_start; for (int iter = 0; !stop_task.load() && iter < p.pushing_iteration_limit; ++iter) { remaining = compute.run( slv, x, m_local_ctx.rng, kappa, delta, theta); if (remaining == 0) { best_recorder.try_update( m_local_ctx, x, original_costs.results(x, cost_constant), -push * p.pushing_iteration_limit - iter - 1); is_a_solution = true; break; } if (iter > p.w) kappa += kappa_step * std::pow(static_cast<Float>(remaining) / static_cast<Float>(slv.m), alpha); if (kappa > kappa_max) break; } } } }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x168, %rsp # imm = 0x168 movq %rdi, %rbp leaq 0x20(%rsp), %rdi movq %rsi, %r15 movl %r8d, %esi vmovsd %xmm0, 0x60(%rsp) movq %r9, %r12 movl %r8d, %ebx movq %rcx, %r14 movq %rdx, 0x30(%rsp) callq 0x368ae movq (%rbp), %r13 movq %rbp, 0x78(%rsp) addq $0x8, %rbp leaq 0x88(%rsp), %rdi movq %r13, %rsi movq %r12, 0x58(%rsp) movq %r12, %rdx movq %rbp, %rcx movl %ebx, %r8d callq 0x46c07 vmovsd 0x20(%r13), %xmm0 vmovsd 0x10(%r13), %xmm2 vxorpd %xmm1, %xmm1, %xmm1 vmovsd %xmm0, 0x8(%rsp) vmovsd 0x28(%r13), %xmm0 vucomisd %xmm2, %xmm1 vmovsd %xmm0, 0x50(%rsp) vmovsd 0x30(%r13), %xmm0 vmovsd %xmm0, 0x48(%rsp) vcvtsd2ss 0x8(%r13), %xmm3, %xmm0 vmovss %xmm0, 0x14(%rsp) jbe 0x467a0 movq 0x78(%rsp), %rax movq (%rax), %rdi leaq 0x88(%rsp), %rsi movl %ebx, %edx callq 0x46ce1 vmovss %xmm0, 0x10(%rsp) jmp 0x467aa vcvtsd2ss %xmm2, %xmm2, %xmm0 vmovss %xmm0, 0x10(%rsp) vcvttsd2si 0xa0(%r13), %rax vmovsd 0x38(%r13), %xmm0 vmovsd 0x40(%r13), %xmm1 movq %rax, 0x80(%rsp) movq 0x8(%r14), %rax vmovsd %xmm0, 0x40(%rsp) vmovsd %xmm1, 0x68(%rsp) subq (%r14), %rax pushq $0x28 popq %rcx cqto idivq %rcx leaq 0xe0(%rsp), %rdi leaq 0x88(%rsp), %r8 movq %rbp, %rsi movl %eax, %edx movl %ebx, %ecx movq %r14, %r9 callq 0x46d5a movl 0xcc(%r13), %esi leaq 0xa8(%rsp), %rdi movl %ebx, %edx callq 0x38cd8 vcvtsd2ss 0x8(%rsp), %xmm3, %xmm0 vmovss %xmm0, 0x3c(%rsp) vcvtsd2ss 0x50(%rsp), %xmm3, %xmm0 vmovss %xmm0, 0x50(%rsp) vcvtsd2ss 0x48(%rsp), %xmm3, %xmm0 vmovss %xmm0, 0x48(%rsp) vcvtsd2ss 0x40(%rsp), %xmm3, %xmm0 vmovss %xmm0, 0x74(%rsp) vcvtsd2ss 0x68(%rsp), %xmm3, %xmm0 vmovss %xmm0, 0x70(%rsp) movq $0x0, 0x18(%rsp) movb (%r15), %al testb $0x1, %al jne 0x46b6f movq 0x78(%rsp), %rax incq 0xb0(%rax) vmovsd 0x18(%r13), %xmm0 vmovsd 0x28(%r13), %xmm1 movzbl 0x18(%rsp), %edx movq 0x30(%rsp), %rdi leaq 0x20(%rsp), %rbx movq %rbp, %rsi movq %rbx, %rcx andl $0x1, %edx callq 0x46f82 vmovsd %xmm0, 0x8(%rsp) leaq 0xa8(%rsp), %rdi leaq 0xe0(%rsp), %rsi movq %rbx, %rdx callq 0x47082 vcvtsd2ss 0x8(%rsp), %xmm3, %xmm0 movl $0x7fffffff, %ebx # imm = 0x7FFFFFFF xorl %r14d, %r14d vmovss %xmm0, 0x68(%rsp) movb (%r15), %al testb $0x1, %al jne 0x4696d cmpq 0xb0(%r13), %r14 je 0x4696d vmovss 0x10(%rsp), %xmm1 vmovss 0x14(%rsp), %xmm2 leaq 0xa8(%rsp), %rdi leaq 0xe0(%rsp), %rsi leaq 0x20(%rsp), %rdx movq %rbp, %rcx vmovss %xmm0, 0x8(%rsp) callq 0x470c4 testl %eax, %eax je 0x46985 cmpl %eax, %ebx cmovgel %eax, %ebx cmpq 0x80(%rsp), %r14 jle 0x46957 vcvtsi2ss %eax, %xmm3, %xmm0 vcvtsi2ssl 0x160(%rsp), %xmm3, %xmm1 vdivss %xmm1, %xmm0, %xmm0 vmovss 0x48(%rsp), %xmm1 callq 0xb530 vmovss 0x8(%rsp), %xmm1 vfmadd231ss 0x3c(%rsp), %xmm0, %xmm1 # xmm1 = (xmm0 * mem) + xmm1 vmovaps %xmm1, %xmm0 jmp 0x4695d vmovss 0x8(%rsp), %xmm0 vucomiss 0x50(%rsp), %xmm0 ja 0x4696d incq %r14 jmp 0x468ce testl %ebx, %ebx jg 0x46b4f leaq 0x20(%rsp), %rbx movq $0x0, 0x18(%rsp) jmp 0x469b7 vmovsd 0x60(%rsp), %xmm0 movq 0x58(%rsp), %rdi leaq 0x20(%rsp), %rbx movq %rbx, %rsi callq 0x45118 movq 0x30(%rsp), %rdi movq %rbp, %rsi movq %rbx, %rdx movq %r14, %rcx callq 0x472d0 movb $0x1, %al movq %rax, 0x18(%rsp) xorl %r14d, %r14d movl $0x0, 0x40(%rsp) movb (%r15), %al testb $0x1, %al jne 0x4685c cmpl 0xbc(%r13), %r14d jge 0x4685c vmovss 0x74(%rsp), %xmm0 vmovss 0x10(%rsp), %xmm1 vmovss 0x14(%rsp), %xmm2 vmovss 0x70(%rsp), %xmm3 leaq 0xa8(%rsp), %rdi leaq 0xe0(%rsp), %rsi movq %rbx, %rdx movq %rbp, %rcx callq 0x473da testl %eax, %eax jne 0x46a4b vmovsd 0x60(%rsp), %xmm0 movq 0x58(%rsp), %rdi movq %rbx, %rsi callq 0x45118 movl 0xc0(%r13), %eax movq 0x30(%rsp), %rdi movq %rbp, %rsi movq %rbx, %rdx imull %r14d, %eax notl %eax movslq %eax, %rcx callq 0x472d0 movb $0x1, %al movq %rax, 0x18(%rsp) pushq $0x1 popq %rax vmovss 0x68(%rsp), %xmm0 movl %eax, %ebx movb (%r15), %al testb $0x1, %al jne 0x46af9 leal -0x1(%rbx), %r12d cmpl 0xc0(%r13), %r12d jge 0x46af9 vmovss 0x10(%rsp), %xmm1 vmovss 0x14(%rsp), %xmm2 leaq 0xa8(%rsp), %rdi leaq 0xe0(%rsp), %rsi leaq 0x20(%rsp), %rdx movq %rbp, %rcx vmovss %xmm0, 0x8(%rsp) callq 0x470c4 testl %eax, %eax je 0x46b00 vcvtsi2sd %r12d, %xmm4, %xmm0 vucomisd 0xa0(%r13), %xmm0 jbe 0x46ae4 vcvtsi2ss %eax, %xmm4, %xmm0 vcvtsi2ssl 0x160(%rsp), %xmm4, %xmm1 vdivss %xmm1, %xmm0, %xmm0 vmovss 0x48(%rsp), %xmm1 callq 0xb530 vmovss 0x8(%rsp), %xmm1 vfmadd231ss 0x3c(%rsp), %xmm0, %xmm1 # xmm1 = (xmm0 * mem) + xmm1 vmovaps %xmm1, %xmm0 jmp 0x46aea vmovss 0x8(%rsp), %xmm0 vucomiss 0x50(%rsp), %xmm0 ja 0x46af9 incl %ebx jmp 0x46a56 leaq 0x20(%rsp), %rbx jmp 0x46b43 vmovsd 0x60(%rsp), %xmm0 movq 0x58(%rsp), %rdi leaq 0x20(%rsp), %r12 movq %r12, %rsi callq 0x45118 movl 0xc0(%r13), %eax movq 0x30(%rsp), %rdi movq %rbp, %rsi movq %r12, %rdx imull 0x40(%rsp), %eax subl %ebx, %eax movq %r12, %rbx movslq %eax, %rcx callq 0x472d0 movb $0x1, %al movq %rax, 0x18(%rsp) decl 0x40(%rsp) incl %r14d jmp 0x469c2 movq 0xb0(%r13), %r8 movq 0x30(%rsp), %rdi leaq 0x20(%rsp), %rdx movq %rbp, %rsi movl %ebx, %ecx callq 0x47358 jmp 0x46853 leaq 0xa8(%rsp), %rdi callq 0x393ac leaq 0xe0(%rsp), %rdi callq 0x475fc leaq 0x88(%rsp), %rdi callq 0x4495c leaq 0x28(%rsp), %rdi callq 0x357fe addq $0x168, %rsp # imm = 0x168 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq jmp 0x46bb9 movq %rax, %rbx jmp 0x46bdb movq %rax, %rbx jmp 0x46be8 movq %rax, %rbx jmp 0x46bf5 jmp 0x46bcb jmp 0x46bcb jmp 0x46bcb jmp 0x46bcb leaq 0xa8(%rsp), %rdi movq %rax, %rbx callq 0x393ac leaq 0xe0(%rsp), %rdi callq 0x475fc leaq 0x88(%rsp), %rdi callq 0x4495c leaq 0x28(%rsp), %rdi callq 0x357fe movq %rbx, %rdi callq 0xb3d0
/quesnel[P]baryonyx/lib/src/itm-optimizer-common.hpp
float baryonyx::itm::compute_delta<float, baryonyx::itm::quadratic_cost_type<float>>(baryonyx::context const&, baryonyx::itm::quadratic_cost_type<float> const&, float, int)
inline Float compute_delta(const context& ctx, const Cost& c, Float theta, int n) { info(ctx, " - delta not defined, compute it:\n"); const auto mini = c.min(n); const auto ret = mini - theta * mini; info(ctx, " - delta={} (min normalized cost:{} / theta: {})\n", ret, mini, theta); return ret; }
pushq %r15 pushq %r14 pushq %r12 pushq %rbx subq $0x18, %rsp movq %rsi, %r14 leaq 0x14(%rsp), %r12 leaq 0x4134d9(%rip), %rsi # 0x45a1d4 movl %edx, %ebx vmovss %xmm0, 0x8(%rsp) movq %rdi, %r15 vmovss %xmm0, (%r12) callq 0x348e9 movq %r14, %rdi movl %ebx, %esi callq 0x4856e leaq 0x10(%rsp), %rcx leaq 0xc(%rsp), %rbx leaq 0x4134cc(%rip), %rsi # 0x45a1f8 movq %r15, %rdi movq %r12, %r8 vmovss %xmm0, (%rcx) vfnmadd132ss 0x8(%rsp), %xmm0, %xmm0 # xmm0 = -(xmm0 * mem) + xmm0 movq %rbx, %rdx vmovss %xmm0, (%rbx) callq 0x3a459 vmovss (%rbx), %xmm0 addq $0x18, %rsp popq %rbx popq %r12 popq %r14 popq %r15 retq nop
/quesnel[P]baryonyx/lib/src/itm-common.hpp
void baryonyx::itm::quadratic_cost_type<float>::make_random_norm<std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>>(int, std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>&)
void make_random_norm(int n, Random& rng) { std::vector<std::pair<Float, int>> r(n); std::vector<std::pair<quad, int>> q(indices[n]); for (int i = 0; i != n; ++i) r[i] = { linear_elements[i], i }; std::sort(r.begin(), r.end(), [](const auto& lhs, const auto& rhs) { return lhs.first < rhs.first; }); { auto begin = r.begin(); auto end = r.end(); auto next = r.begin()++; for (; next != end; ++next) { if (next->first != begin->first) { if (std::distance(begin, next) > 1) random_epsilon_unique( begin, next, rng, begin->first, next->first); begin = next; } } if (std::distance(begin, end) > 1) { if (begin == r.begin()) { random_epsilon_unique( begin, end, rng, begin->first, begin->first + 1); } else { auto value = linearize(std::ptrdiff_t(0), r.front().first, std::distance(r.begin(), begin), begin->first, std::distance(r.begin(), r.end())); random_epsilon_unique( begin, end, rng, begin->first, value); } } // Reorder the vector according to the variable index, so, // it restores the initial order. std::sort( r.begin(), r.end(), [](const auto& lhs, const auto& rhs) { return lhs.second < rhs.second; }); } { // auto begin = q.begin(); // auto end = q.end(); // auto next = q.begin()++; // for (; next != end; ++next) { // if (next->first != begin->first) { // if (std::distance(begin, next) > 1) // random_epsilon_unique( // begin, next, rng, begin->first, // next->first); // begin = next; // } // } // if (std::distance(begin, end) > 1) { // if (begin == q.begin()) { // random_epsilon_unique( // begin, end, rng, begin->first, begin->first + // 1); // } else { // auto value = linearize(std::ptrdiff_t(0), // q.front().first, // std::distance(q.begin(), // begin), begin->first, // std::distance(q.begin(), // q.end())); // random_epsilon_unique( // begin, end, rng, begin->first, value); // } // } // Reorder the vector according to the variable index, so, // it restores the initial order. // std::sort( // q.begin(), q.end(), [](const auto& lhs, const auto& // rhs) { // return lhs.second < rhs.second; // }); } for (int i = 0; i != n; ++i) linear_elements[i] = r[i].first; // for (int i = 0; i != n; ++i) { // quadratic_elements[i].factor = r[i].first.factor; // Finally we compute the l+oo norm. make_loo_norm(n); }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x48, %rsp movq %rdx, %r15 movq %rdi, %rbx movslq %esi, %r14 leaq 0x10(%rsp), %rdi leaq 0x30(%rsp), %rdx movl %esi, %ebp movq %r14, %rsi callq 0x39742 movq 0x18(%rbx), %rax movslq (%rax,%r14,4), %rsi leaq 0x30(%rsp), %rdi leaq 0xf(%rsp), %rdx callq 0x47ac0 movq 0x8(%rbx), %rax movq 0x10(%rsp), %rcx movl %ebp, %r14d xorl %edx, %edx cmpq %rdx, %r14 je 0x47784 vmovss (%rax,%rdx,4), %xmm0 vmovss %xmm0, (%rcx,%rdx,8) movl %edx, 0x4(%rcx,%rdx,8) incq %rdx jmp 0x4776c movq 0x10(%rsp), %rdi movq 0x18(%rsp), %rsi movq %rbx, 0x28(%rsp) callq 0x47c0b movq 0x10(%rsp), %rbx movq 0x18(%rsp), %r12 movq %rbx, %rbp movq %rbx, %r13 cmpq %r12, %rbp je 0x477f2 vmovss (%rbp), %xmm1 vmovss (%r13), %xmm0 vucomiss %xmm0, %xmm1 jne 0x477c0 jnp 0x477e2 movq %rbx, %rcx subq %r13, %rcx movq %rbp, %rax cmpq $0x9, %rcx jl 0x477e5 movq %r13, %rdi movq %rbp, %rsi movq %r15, %rdx callq 0x39795 movq %rbp, %rax jmp 0x477e5 movq %r13, %rax addq $0x8, %rbp addq $0x8, %rbx movq %rax, %r13 jmp 0x477a8 movq %r12, %rax subq %r13, %rax cmpq $0x9, %rax jl 0x47862 movq 0x10(%rsp), %rax movq %r13, %rsi subq %rax, %rsi je 0x47846 vmovss (%rax), %xmm0 vmovss (%r13), %xmm1 movq 0x18(%rsp), %rdx sarq $0x3, %rsi xorl %edi, %edi subq %rax, %rdx sarq $0x3, %rdx callq 0x39806 vmovaps %xmm0, %xmm1 vmovss (%r13), %xmm0 movq %r13, %rdi movq %r12, %rsi movq %r15, %rdx callq 0x39795 jmp 0x47862 vmovss (%r13), %xmm0 vaddss 0x412270(%rip), %xmm0, %xmm1 # 0x459ac4 movq %r13, %rdi movq %r12, %rsi movq %r15, %rdx callq 0x39795 movq 0x10(%rsp), %rdi movq 0x18(%rsp), %rsi callq 0x480c9 movq 0x28(%rsp), %rdi movq 0x10(%rsp), %rax xorl %edx, %edx movq 0x8(%rdi), %rcx cmpq %rdx, %r14 je 0x47895 vmovss (%rax,%rdx,8), %xmm0 vmovss %xmm0, (%rcx,%rdx,4) incq %rdx jmp 0x47881 movl %r14d, %esi callq 0x47a2a leaq 0x30(%rsp), %rdi callq 0x47b46 leaq 0x10(%rsp), %rdi callq 0x3988e addq $0x48, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq jmp 0x478cb movq %rax, %rbx jmp 0x478d8 jmp 0x478cb jmp 0x478cb leaq 0x30(%rsp), %rdi movq %rax, %rbx callq 0x47b46 leaq 0x10(%rsp), %rdi callq 0x3988e movq %rbx, %rdi callq 0xb3d0
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::itm::quadratic_cost_type<float>::make_l1_norm(int)
void make_l1_norm(int n) { Float div = { 0 }; for (int i = 0; i != n; ++i) div += std::abs(linear_elements[i]); for (int i = 0, e = indices[n]; i != e; ++i) div += std::abs(quadratic_elements[i].factor); if (std::isnormal(div)) { for (int i = 0; i != n; ++i) linear_elements[i] /= div; for (int i = 0, e = indices[n]; i != e; ++i) quadratic_elements[i].factor /= div; } }
vbroadcastss 0x4121d5(%rip), %xmm1 # 0x459ac8 movq 0x8(%rdi), %rax vxorps %xmm0, %xmm0, %xmm0 movl %esi, %ecx xorl %edx, %edx cmpq %rdx, %rcx je 0x47916 vmovss (%rax,%rdx,4), %xmm2 incq %rdx vandps %xmm1, %xmm2, %xmm2 vaddss %xmm2, %xmm0, %xmm0 jmp 0x478ff movq 0x18(%rdi), %r8 movslq %esi, %rdx movq 0x10(%rdi), %rsi movl (%r8,%rdx,4), %edx xorl %r8d, %r8d cmpq %r8, %rdx je 0x47940 vmovss (%rsi,%r8,8), %xmm2 incq %r8 vandps %xmm1, %xmm2, %xmm2 vaddss %xmm2, %xmm0, %xmm0 jmp 0x47928 vmovd %xmm0, %esi andl $0x7fffffff, %esi # imm = 0x7FFFFFFF addl $0xff800000, %esi # imm = 0xFF800000 cmpl $0x7effffff, %esi # imm = 0x7EFFFFFF ja 0x47990 xorl %esi, %esi cmpq %rsi, %rcx je 0x47972 vmovss (%rax,%rsi,4), %xmm1 vdivss %xmm0, %xmm1, %xmm1 vmovss %xmm1, (%rax,%rsi,4) incq %rsi jmp 0x4795a movq 0x10(%rdi), %rax xorl %ecx, %ecx cmpq %rcx, %rdx je 0x47990 vmovss (%rax,%rcx,8), %xmm1 vdivss %xmm0, %xmm1, %xmm1 vmovss %xmm1, (%rax,%rcx,8) incq %rcx jmp 0x47978 retq nop
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::itm::quadratic_cost_type<float>::make_l2_norm(int)
void make_l2_norm(int n) { Float div = { 0 }; for (int i = 0; i != n; ++i) div += linear_elements[i] * linear_elements[i]; ; for (int i = 0, e = indices[n]; i != e; ++i) div += quadratic_elements[i].factor * quadratic_elements[i].factor; if (std::isnormal(div)) { for (int i = 0; i != n; ++i) linear_elements[i] /= div; for (int i = 0, e = indices[n]; i != e; ++i) quadratic_elements[i].factor /= div; } }
movq 0x8(%rdi), %rax vxorps %xmm0, %xmm0, %xmm0 movl %esi, %ecx xorl %edx, %edx cmpq %rdx, %rcx je 0x479b2 vmovss (%rax,%rdx,4), %xmm1 incq %rdx vfmadd231ss %xmm1, %xmm1, %xmm0 # xmm0 = (xmm1 * xmm1) + xmm0 jmp 0x4799e movq 0x18(%rdi), %r8 movslq %esi, %rdx movq 0x10(%rdi), %rsi movl (%r8,%rdx,4), %edx xorl %r8d, %r8d cmpq %r8, %rdx je 0x479d9 vmovss (%rsi,%r8,8), %xmm1 incq %r8 vfmadd231ss %xmm1, %xmm1, %xmm0 # xmm0 = (xmm1 * xmm1) + xmm0 jmp 0x479c4 vmovd %xmm0, %esi andl $0x7fffffff, %esi # imm = 0x7FFFFFFF addl $0xff800000, %esi # imm = 0xFF800000 cmpl $0x7effffff, %esi # imm = 0x7EFFFFFF ja 0x47a29 xorl %esi, %esi cmpq %rsi, %rcx je 0x47a0b vmovss (%rax,%rsi,4), %xmm1 vdivss %xmm0, %xmm1, %xmm1 vmovss %xmm1, (%rax,%rsi,4) incq %rsi jmp 0x479f3 movq 0x10(%rdi), %rax xorl %ecx, %ecx cmpq %rcx, %rdx je 0x47a29 vmovss (%rax,%rcx,8), %xmm1 vdivss %xmm0, %xmm1, %xmm1 vmovss %xmm1, (%rax,%rcx,8) incq %rcx jmp 0x47a11 retq
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::itm::quadratic_cost_type<float>::make_loo_norm(int)
void make_loo_norm(int n) { Float div = *std::max_element(linear_elements.get(), linear_elements.get() + n); for (int i = 0, e = indices[n]; i != e; ++i) div = std::max(quadratic_elements[i].factor, div); if (std::isnormal(div)) { for (int i = 0; i != n; ++i) linear_elements[i] /= div; for (int i = 0, e = indices[n]; i != e; ++i) quadratic_elements[i].factor /= div; } }
pushq %rbp pushq %r14 pushq %rbx movq %rdi, %rbx movq 0x8(%rdi), %rdi movslq %esi, %r14 movl %esi, %ebp leaq (%rdi,%r14,4), %rsi callq 0x3a3e5 movq 0x18(%rbx), %rsi vmovss (%rax), %xmm0 movq 0x10(%rbx), %rcx xorl %edx, %edx movl (%rsi,%r14,4), %eax cmpq %rdx, %rax je 0x47a64 vmaxss (%rcx,%rdx,8), %xmm0, %xmm0 incq %rdx jmp 0x47a55 vmovd %xmm0, %ecx andl $0x7fffffff, %ecx # imm = 0x7FFFFFFF addl $0xff800000, %ecx # imm = 0xFF800000 cmpl $0x7effffff, %ecx # imm = 0x7EFFFFFF ja 0x47aba movq 0x8(%rbx), %rcx movl %ebp, %edx xorl %esi, %esi cmpq %rsi, %rdx je 0x47a9c vmovss (%rcx,%rsi,4), %xmm1 vdivss %xmm0, %xmm1, %xmm1 vmovss %xmm1, (%rcx,%rsi,4) incq %rsi jmp 0x47a84 movq 0x10(%rbx), %rcx xorl %edx, %edx cmpq %rdx, %rax je 0x47aba vmovss (%rcx,%rdx,8), %xmm1 vdivss %xmm0, %xmm1, %xmm1 vmovss %xmm1, (%rcx,%rdx,8) incq %rdx jmp 0x47aa2 popq %rbx popq %r14 popq %rbp retq nop
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::itm::quadratic_cost_type<float>::min(int) const
Float min(int n) const noexcept { Float min = std::numeric_limits<Float>::max(); for (int i = 0; i != n; ++i) if (linear_elements[i]) min = std::min(min, std::abs(linear_elements[i])); for (int i = 0, e = indices[n]; i != e; ++i) if (quadratic_elements[i].factor) min = std::min(min, std::abs(quadratic_elements[i].factor)); return min; }
vmovss 0x411556(%rip), %xmm0 # 0x459acc vbroadcastss 0x411549(%rip), %xmm1 # 0x459ac8 movq 0x8(%rdi), %rax vxorps %xmm2, %xmm2, %xmm2 movl %esi, %ecx xorl %edx, %edx cmpq %rdx, %rcx je 0x485b6 vmovss (%rax,%rdx,4), %xmm3 incq %rdx vandps %xmm1, %xmm3, %xmm4 vcmpneqps %xmm2, %xmm3, %k1 vcmpltps %xmm0, %xmm4, %k0 kandw %k0, %k1, %k1 vmovss %xmm4, %xmm0, %xmm0 {%k1} jmp 0x4858b movq 0x18(%rdi), %rdx movslq %esi, %rcx movq 0x10(%rdi), %rax vxorps %xmm2, %xmm2, %xmm2 movl (%rdx,%rcx,4), %ecx xorl %edx, %edx cmpq %rdx, %rcx je 0x485f5 vmovss (%rax,%rdx,8), %xmm3 incq %rdx vandps %xmm1, %xmm3, %xmm4 vcmpneqps %xmm2, %xmm3, %k1 vcmpltps %xmm0, %xmm4, %k0 kandw %k0, %k1, %k1 vmovss %xmm4, %xmm0, %xmm0 {%k1} jmp 0x485ca retq
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::itm::best_solution_recorder<baryonyx::itm::quadratic_cost_type<float>, float, baryonyx::itm::maximize_tag>::mutation(baryonyx::itm::local_context&, baryonyx::bit_array&)
void mutation(local_context& ctx, bit_array& x) { if (ctx.value_p_dist.mean() == 0.0 && ctx.value_p_dist.stddev() == 0.0) return; double val_p, var_p; do var_p = ctx.variable_p_dist(ctx.rng); while (var_p <= 0.0 || var_p >= 1.0); do val_p = ctx.value_p_dist(ctx.rng); while (val_p < 0.0 || val_p > 1.0); to_log(stdout, 7u, "- mutation variables {}% with " " {}% of set\n", var_p, val_p); std::bernoulli_distribution dist_var_p(var_p); std::bernoulli_distribution dist_value_p(val_p); for (int i = 0, e = x.size(); i != e; ++i) { if (dist_var_p(ctx.rng)) { to_log(stdout, 9u, "- mutate variable {}\n", i); x.set(i, dist_value_p(ctx.rng)); } } }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x28, %rsp vmovsd 0x48(%rsi), %xmm0 vxorpd %xmm1, %xmm1, %xmm1 movq %rdx, %rbx movq %rsi, %r14 vucomisd %xmm1, %xmm0 jne 0x48702 jp 0x48702 vmovsd 0x50(%r14), %xmm0 vucomisd %xmm1, %xmm0 jne 0x48702 jp 0x48702 addq $0x28, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq leaq 0x48(%r14), %r15 leaq 0x28(%r14), %r12 movq %r12, %rdi movq %r14, %rsi callq 0x3c480 vxorpd %xmm1, %xmm1, %xmm1 vucomisd %xmm0, %xmm1 jae 0x4870a vucomisd 0x40b911(%rip), %xmm0 # 0x454038 jae 0x4870a vmovsd %xmm0, 0x18(%rsp) movq %r15, %rdi movq %r14, %rsi callq 0x3c480 vxorpd %xmm1, %xmm1, %xmm1 vucomisd %xmm0, %xmm1 ja 0x4872f vucomisd 0x40b8ec(%rip), %xmm0 # 0x454038 ja 0x4872f movq 0x5f4873(%rip), %rax # 0x63cfc8 leaq 0x20(%rsp), %r15 leaq 0x411cbb(%rip), %rcx # 0x45a41c vmovsd %xmm0, (%r15) movq (%rax), %rdi pushq $0x7 popq %rsi pushq $0x2a popq %rdx leaq 0x18(%rsp), %r12 movq %r15, %r9 movq %r12, %r8 callq 0x3c5d8 vmovsd (%r12), %xmm0 vmovsd (%r15), %xmm1 leaq 0x4(%rsp), %rax andl $0x0, (%rax) xorl %eax, %eax movl (%rbx), %r15d vmovsd %xmm0, 0x10(%rsp) vmovsd %xmm1, 0x8(%rsp) pushq $0x9 popq %rbp pushq $0x15 popq %r13 cmpl %r15d, %eax je 0x486f3 movq %r14, %rdi callq 0x36ac3 vmovsd 0x10(%rsp), %xmm1 vucomisd %xmm0, %xmm1 jbe 0x4880e movq 0x5f47fa(%rip), %rax # 0x63cfc8 leaq 0x411c72(%rip), %rcx # 0x45a447 leaq 0x4(%rsp), %r8 movl %ebp, %esi movq %r13, %rdx movq (%rax), %rdi callq 0x3c631 movl 0x4(%rsp), %r12d movq %r14, %rdi callq 0x36ac3 vmovsd 0x8(%rsp), %xmm1 xorl %edx, %edx movq %rbx, %rdi movl %r12d, %esi vucomisd %xmm0, %xmm1 seta %dl callq 0x3c67e movl 0x4(%rsp), %eax incl %eax movl %eax, 0x4(%rsp) jmp 0x487aa
/quesnel[P]baryonyx/lib/src/itm-optimizer-common.hpp
bool baryonyx::itm::is_valid_constraint<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>>, baryonyx::bit_array>(baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>> const&, int, baryonyx::bit_array const&)
bool is_valid_constraint(const Solver& slv, int k, const Xtype& x) { typename sparse_matrix<int>::const_row_iterator it, et; std::tie(it, et) = slv.ap.row(k); int v = 0; for (; it != et; ++it) v += slv.factor(it->value) * x[it->column]; return slv.bound_min(k) <= v && v <= slv.bound_max(k); }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x18, %rsp movq %rdx, %r14 movl %esi, %edx leaq 0x8(%rdi), %rsi leaq 0x8(%rsp), %r15 movq %rdi, %rbx movl %edx, 0x4(%rsp) movq %r15, %rdi callq 0x3c868 movq (%r15), %r12 movq 0x8(%r15), %r13 xorl %r15d, %r15d cmpq %r12, %r13 je 0x48cde movslq (%r13), %rax movq 0x48(%rbx), %rcx movl 0x4(%r13), %esi movq %r14, %rdi movl (%rcx,%rax,4), %ebp callq 0x3664a imull %ebp, %eax addq $0x8, %r13 addl %eax, %r15d jmp 0x48cb6 movslq 0x4(%rsp), %rcx movq 0x58(%rbx), %rax imulq $0xc, %rcx, %rcx cmpl %r15d, (%rax,%rcx) jle 0x48cf5 xorl %eax, %eax jmp 0x48cfd cmpl 0x4(%rax,%rcx), %r15d setle %al addq $0x18, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq
/quesnel[P]baryonyx/lib/src/itm-common.hpp
bool baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>>::compute_update_row<baryonyx::bit_array, std::reverse_iterator<__gnu_cxx::__normal_iterator<int const*, std::vector<int, std::allocator<int>>>>>(baryonyx::bit_array&, std::reverse_iterator<__gnu_cxx::__normal_iterator<int const*, std::vector<int, std::allocator<int>>>>, std::reverse_iterator<__gnu_cxx::__normal_iterator<int const*, std::vector<int, std::allocator<int>>>>, float, float, float)
bool compute_update_row(Xtype& x, Iterator first, Iterator last, Float kappa, Float delta, Float theta) { for (; first != last; ++first) { auto k = constraint(first); bx_expects(k < m); auto [row_begin, row_end] = ap.row(k); decrease_preference(row_begin, row_end, theta); int r_size = 0; for (auto it = row_begin; it != row_end; ++it, ++r_size) { Float sum_a_p = 0; auto [col_begin, col_end] = ap.column(it->column); for (; col_begin != col_end; ++col_begin) sum_a_p += static_cast<Float>(A[col_begin->value]) * P[col_begin->value]; R[r_size].id = r_size; R[r_size].a = A[it->value]; R[r_size].value = c(row_begin->column, x) - sum_a_p; } calculator_sort<Mode>(R.get(), R.get() + r_size, rng); int value = 0; bool valid = b[k].min <= 0; int i = -1; // if (!valid) { // do { // ++i; // value += R[i].a; // valid = b[k].min <= value; // } while (!valid && i + 1 < r_size); // } // valid = b[k].min <= value && value <= b[k].max; // while (i + 1 < r_size && valid) { // ++i; // value += R[i].a; // valid = b[k].min <= value && value <= b[k].max; // } // std::uniform_real_distribution<Float> real_dist(Float{ 0 }, // Float{ 1 }); // auto selected = i; // auto d = delta; // if (selected < 0) { // d += (kappa / (one - kappa)) * (R[0].value / two); // d *= real_dist(rng); // for (i = 0; i != r_size; ++i) { // auto var = row_begin + R[i].id; // if (R[i].is_negative()) { // x.set(var->column, 1); // P[var->value] += d; // } else { // x.set(var->column, 0); // P[var->value] -= d; // } // } // } else if (selected + 1 >= r_size) { // d += (kappa / (one - kappa)) * (R[selected].value * middle); // d *= real_dist(rng); // for (i = 0; i != r_size; ++i) { // auto var = row_begin + R[i].id; // if (R[i].is_negative()) { // x.set(var->column, 0); // P[var->value] -= d; // } else { // x.set(var->column, 1); // P[var->value] += d; // } // } // } else { // d += (kappa / (one - kappa)) * // (R[selected + 1].value - R[selected].value); // d *= real_dist(rng); // for (i = 0; i <= selected; ++i) { // auto var = row_begin + R[i].id; // if (R[i].is_negative()) { // x.set(var->column, 0); // P[var->value] -= d; // } else { // x.set(var->column, 1); // P[var->value] += d; // } // } // for (; i != r_size; ++i) { // auto var = row_begin + R[i].id; // if (R[i].is_negative()) { // x.set(var->column, 1); // P[var->value] += d; // } else { // x.set(var->column, 0); // P[var->value] -= d; // } // } constexpr Float one{ 1 }; constexpr Float two{ 2 }; if (!valid) { do { ++i; value += R[i].a; valid = b[k].min <= value; auto var = row_begin + R[i].id; x.set(var->column); P[var->value] += delta + (kappa / (one - kappa)) * (R[i].value / two); } while (!valid && i + 1 < r_size); } valid = b[k].min <= value && value <= b[k].max; while (i + 1 < r_size && valid) { ++i; value += R[i].a; valid = b[k].min <= value && value <= b[k].max; auto var = row_begin + R[i].id; if (valid) valid = stop_iterating<Mode>(R[i].value, rng); if (valid) { x.set(var->column); P[var->value] += delta + (kappa / (one - kappa)) * (R[i].value / two); } else { x.unset(var->column); P[var->value] -= delta + (kappa / (one - kappa)) * (R[i].value / two); } } while (i + 1 < r_size) { ++i; auto var = row_begin + R[i].id; x.unset(var->column); P[var->value] -= delta + (kappa / (one - kappa)) * (R[i].value / two); } bx_expects(is_valid_constraint(*this, k, x)); } return false; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x88, %rsp vmovss %xmm1, 0xc(%rsp) vmovss 0x410d99(%rip), %xmm1 # 0x459ac4 movq (%rdx), %rax leaq 0x8(%rdi), %r15 vmovss %xmm2, 0x3c(%rsp) movq %rcx, 0x60(%rsp) movq %rsi, %r13 movq %rdi, %r12 movq %rdx, 0x58(%rsp) movq %rdi, 0x20(%rsp) movq %rsi, 0x18(%rsp) movq %r15, 0x50(%rsp) vsubss %xmm0, %xmm1, %xmm1 vdivss %xmm1, %xmm0, %xmm0 vmovss %xmm0, 0x8(%rsp) movq 0x60(%rsp), %rcx cmpq (%rcx), %rax je 0x49121 movslq -0x4(%rax), %rdx cmpl 0x80(%r12), %edx jge 0x49135 leaq 0x28(%rsp), %rdi movq %rdx, 0x40(%rsp) movq %r15, %rsi callq 0x3de66 vmovss 0x3c(%rsp), %xmm0 movq 0x28(%rsp), %rdx movq 0x30(%rsp), %rsi movq %r12, %rdi callq 0x49fdc movq 0x30(%rsp), %rbx xorl %ebp, %ebp cmpq 0x28(%rsp), %rbx je 0x48e5e movl 0x4(%rbx), %edx leaq 0x78(%rsp), %rdi movq %r15, %rsi callq 0x3dede movq 0x78(%rsp), %rcx movq 0x80(%rsp), %rdx movq 0x48(%r12), %rax movq 0x68(%r12), %rsi vxorps %xmm1, %xmm1, %xmm1 cmpq %rcx, %rdx je 0x48e0d movslq (%rdx), %rdi addq $0x8, %rdx vcvtsi2ssl (%rax,%rdi,4), %xmm3, %xmm0 vfmadd231ss (%rsi,%rdi,4), %xmm0, %xmm1 # xmm1 = (xmm0 * mem) + xmm1 movq %rdx, 0x80(%rsp) jmp 0x48dec movq 0x50(%r12), %rcx imulq $0xc, %rbp, %r14 vmovss %xmm1, 0x10(%rsp) movl %ebp, 0x4(%rcx,%r14) movslq (%rbx), %rdx movl (%rax,%rdx,4), %eax movq %r13, %rdx movl %eax, 0x8(%rcx,%r14) movq 0x30(%rsp), %rax movq 0x70(%r12), %rdi movl 0x4(%rax), %esi callq 0x49ffa vsubss 0x10(%rsp), %xmm0, %xmm0 movq 0x50(%r12), %rax addq $0x8, %rbx incq %rbp vmovss %xmm0, (%rax,%r14) jmp 0x48db6 movq 0x50(%r12), %rdi movq (%r12), %rdx movl %ebp, %eax imulq $0xc, %rax, %rsi addq %rdi, %rsi callq 0x4a06e imulq $0xc, 0x40(%rsp), %rdx movq 0x58(%r12), %rax movq %rbp, 0x68(%rsp) cmpl $0x0, (%rax,%rdx) movq %rdx, 0x48(%rsp) jle 0x48f5c leal -0x2(%rbp), %eax movabsq $-0x100000000, %r14 # imm = 0xFFFFFFFF00000000 xorl %r15d, %r15d cltq movq %rax, 0x70(%rsp) movq 0x50(%r12), %rax pushq $-0x1 popq %rbx xorl %ebp, %ebp movabsq $0x100000000, %rcx # imm = 0x100000000 movq 0x30(%rsp), %r13 movq 0x18(%rsp), %rdi addl 0x8(%rax,%r15), %ebp addq %rcx, %r14 movq 0x58(%r12), %rcx movslq 0x4(%rax,%r15), %r12 movl (%rcx,%rdx), %ecx movl 0x4(%r13,%r12,8), %esi movl %ecx, 0x10(%rsp) callq 0x369c8 movq 0x20(%rsp), %rax movslq (%r13,%r12,8), %rcx movq 0x20(%rsp), %r12 vmovss 0x410bcd(%rip), %xmm0 # 0x459ad0 vmovss 0x8(%rsp), %xmm1 movq 0x50(%rax), %rax movq 0x68(%r12), %rdx vmulss (%rax,%r15), %xmm0, %xmm0 vfmadd213ss 0xc(%rsp), %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + mem vaddss (%rdx,%rcx,4), %xmm0, %xmm0 vmovss %xmm0, (%rdx,%rcx,4) movq 0x48(%rsp), %rdx cmpl %ebp, 0x10(%rsp) jle 0x48f4a addq $0xc, %r15 leaq 0x1(%rbx), %rcx cmpq 0x70(%rsp), %rbx movq %rcx, %rbx jl 0x48eb5 movq 0x58(%r12), %rax sarq $0x20, %r14 cmpl %ebp, (%rax,%rdx) jle 0x48f62 xorl %eax, %eax jmp 0x48f69 xorl %ebp, %ebp pushq $-0x1 popq %r14 cmpl 0x4(%rax,%rdx), %ebp setle %al movslq 0x68(%rsp), %rcx imulq $0xc, %r14, %r15 leaq 0x1(%r14), %rbx movq %rcx, 0x10(%rsp) incq %r14 cmpq 0x10(%rsp), %r14 jae 0x4907e testb $0x1, %al je 0x4907e movq 0x50(%r12), %rax movq 0x58(%r12), %rcx addl 0x14(%rax,%r15), %ebp cmpl %ebp, (%rcx,%rdx) jle 0x48fb5 movslq 0x10(%rax,%r15), %r13 shlq $0x3, %r13 addq 0x30(%rsp), %r13 jmp 0x49025 movslq 0x10(%rax,%r15), %r13 addq %rdx, %rcx shlq $0x3, %r13 addq 0x30(%rsp), %r13 cmpl 0x4(%rcx), %ebp jg 0x49025 vmovss 0xc(%rax,%r15), %xmm0 movq (%r12), %rdi callq 0x3df6c testb %al, %al je 0x49025 movl 0x4(%r13), %esi movq 0x18(%rsp), %rdi callq 0x369c8 movq 0x50(%r12), %rax vmovss 0x410ad6(%rip), %xmm0 # 0x459ad0 movq 0x68(%r12), %rcx vmovss 0x8(%rsp), %xmm1 vmulss 0xc(%rax,%r15), %xmm0, %xmm0 movslq (%r13), %rax vfmadd213ss 0xc(%rsp), %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + mem vaddss (%rcx,%rax,4), %xmm0, %xmm0 vmovss %xmm0, (%rcx,%rax,4) movb $0x1, %al jmp 0x4906d movl 0x4(%r13), %esi movq 0x18(%rsp), %rdi callq 0x36a06 movq 0x50(%r12), %rax vmovss 0x410a90(%rip), %xmm0 # 0x459ad0 movq 0x68(%r12), %rcx vmovss 0x8(%rsp), %xmm1 vmulss 0xc(%rax,%r15), %xmm0, %xmm0 movslq (%r13), %rax vfmadd213ss 0xc(%rsp), %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + mem vmovss (%rcx,%rax,4), %xmm1 vsubss %xmm0, %xmm1, %xmm0 vmovss %xmm0, (%rcx,%rax,4) xorl %eax, %eax movq 0x48(%rsp), %rdx addq $0xc, %r15 incq %rbx jmp 0x48f7b movq 0x18(%rsp), %r13 cmpq 0x10(%rsp), %rbx jae 0x490f4 movq 0x50(%r12), %rax movq 0x30(%rsp), %r14 movq %r13, %rdi movslq 0x10(%rax,%r15), %r12 movl 0x4(%r14,%r12,8), %esi callq 0x36a06 movq 0x20(%rsp), %rax movq 0x20(%rsp), %rcx vmovss 0x410a18(%rip), %xmm0 # 0x459ad0 vmovss 0x8(%rsp), %xmm1 incq %rbx movq 0x50(%rax), %rax movq 0x68(%rcx), %rcx vmulss 0xc(%rax,%r15), %xmm0, %xmm0 movslq (%r14,%r12,8), %rax movq 0x20(%rsp), %r12 addq $0xc, %r15 vfmadd213ss 0xc(%rsp), %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + mem vmovss (%rcx,%rax,4), %xmm1 vsubss %xmm0, %xmm1, %xmm0 vmovss %xmm0, (%rcx,%rax,4) jmp 0x49083 movq 0x40(%rsp), %rsi movq %r12, %rdi movq %r13, %rdx callq 0x48c81 testb %al, %al je 0x49156 movq 0x58(%rsp), %rcx movq 0x50(%rsp), %r15 movq (%rcx), %rax addq $-0x4, %rax movq %rax, (%rcx) jmp 0x48d65 xorl %eax, %eax addq $0x88, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq leaq 0x40f0a2(%rip), %rdi # 0x4581de leaq 0x411337(%rip), %rsi # 0x45a47a leaq 0x4110fd(%rip), %rdx # 0x45a247 leaq 0x41132f(%rip), %rcx # 0x45a480 callq 0x2813f leaq 0x40f081(%rip), %rdi # 0x4581de leaq 0x411320(%rip), %rsi # 0x45a484 leaq 0x4110dc(%rip), %rdx # 0x45a247 leaq 0x411333(%rip), %rcx # 0x45a4a5 callq 0x2813f nop
/quesnel[P]baryonyx/lib/src/random-solver.cpp
bool baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>>::compute_update_row<baryonyx::bit_array, __gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>>(baryonyx::bit_array&, __gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>, __gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>, float, float, float)
bool compute_update_row(Xtype& x, Iterator first, Iterator last, Float kappa, Float delta, Float theta) { for (; first != last; ++first) { auto k = constraint(first); bx_expects(k < m); auto [row_begin, row_end] = ap.row(k); decrease_preference(row_begin, row_end, theta); int r_size = 0; for (auto it = row_begin; it != row_end; ++it, ++r_size) { Float sum_a_p = 0; auto [col_begin, col_end] = ap.column(it->column); for (; col_begin != col_end; ++col_begin) sum_a_p += static_cast<Float>(A[col_begin->value]) * P[col_begin->value]; R[r_size].id = r_size; R[r_size].a = A[it->value]; R[r_size].value = c(row_begin->column, x) - sum_a_p; } calculator_sort<Mode>(R.get(), R.get() + r_size, rng); int value = 0; bool valid = b[k].min <= 0; int i = -1; // if (!valid) { // do { // ++i; // value += R[i].a; // valid = b[k].min <= value; // } while (!valid && i + 1 < r_size); // } // valid = b[k].min <= value && value <= b[k].max; // while (i + 1 < r_size && valid) { // ++i; // value += R[i].a; // valid = b[k].min <= value && value <= b[k].max; // } // std::uniform_real_distribution<Float> real_dist(Float{ 0 }, // Float{ 1 }); // auto selected = i; // auto d = delta; // if (selected < 0) { // d += (kappa / (one - kappa)) * (R[0].value / two); // d *= real_dist(rng); // for (i = 0; i != r_size; ++i) { // auto var = row_begin + R[i].id; // if (R[i].is_negative()) { // x.set(var->column, 1); // P[var->value] += d; // } else { // x.set(var->column, 0); // P[var->value] -= d; // } // } // } else if (selected + 1 >= r_size) { // d += (kappa / (one - kappa)) * (R[selected].value * middle); // d *= real_dist(rng); // for (i = 0; i != r_size; ++i) { // auto var = row_begin + R[i].id; // if (R[i].is_negative()) { // x.set(var->column, 0); // P[var->value] -= d; // } else { // x.set(var->column, 1); // P[var->value] += d; // } // } // } else { // d += (kappa / (one - kappa)) * // (R[selected + 1].value - R[selected].value); // d *= real_dist(rng); // for (i = 0; i <= selected; ++i) { // auto var = row_begin + R[i].id; // if (R[i].is_negative()) { // x.set(var->column, 0); // P[var->value] -= d; // } else { // x.set(var->column, 1); // P[var->value] += d; // } // } // for (; i != r_size; ++i) { // auto var = row_begin + R[i].id; // if (R[i].is_negative()) { // x.set(var->column, 1); // P[var->value] += d; // } else { // x.set(var->column, 0); // P[var->value] -= d; // } // } constexpr Float one{ 1 }; constexpr Float two{ 2 }; if (!valid) { do { ++i; value += R[i].a; valid = b[k].min <= value; auto var = row_begin + R[i].id; x.set(var->column); P[var->value] += delta + (kappa / (one - kappa)) * (R[i].value / two); } while (!valid && i + 1 < r_size); } valid = b[k].min <= value && value <= b[k].max; while (i + 1 < r_size && valid) { ++i; value += R[i].a; valid = b[k].min <= value && value <= b[k].max; auto var = row_begin + R[i].id; if (valid) valid = stop_iterating<Mode>(R[i].value, rng); if (valid) { x.set(var->column); P[var->value] += delta + (kappa / (one - kappa)) * (R[i].value / two); } else { x.unset(var->column); P[var->value] -= delta + (kappa / (one - kappa)) * (R[i].value / two); } } while (i + 1 < r_size) { ++i; auto var = row_begin + R[i].id; x.unset(var->column); P[var->value] -= delta + (kappa / (one - kappa)) * (R[i].value / two); } bx_expects(is_valid_constraint(*this, k, x)); } return false; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x88, %rsp vmovss %xmm1, 0xc(%rsp) vmovss 0x41092d(%rip), %xmm1 # 0x459ac4 leaq 0x8(%rdi), %r15 vmovss %xmm2, 0x3c(%rsp) movq %rcx, 0x58(%rsp) movq %rsi, %r13 movq %rdi, %r12 movq %rdi, 0x20(%rsp) movq %rsi, 0x18(%rsp) movq %r15, 0x50(%rsp) vsubss %xmm0, %xmm1, %xmm1 vdivss %xmm1, %xmm0, %xmm0 vmovss %xmm0, 0x8(%rsp) cmpq 0x58(%rsp), %rdx je 0x49582 movslq (%rdx), %rax cmpl 0x80(%r12), %eax jge 0x49596 leaq 0x28(%rsp), %rdi movq %rdx, 0x60(%rsp) movq %r15, %rsi movl %eax, %edx movq %rax, 0x40(%rsp) callq 0x3de66 vmovss 0x3c(%rsp), %xmm0 movq 0x28(%rsp), %rdx movq 0x30(%rsp), %rsi movq %r12, %rdi callq 0x49fdc movq 0x30(%rsp), %rbx xorl %ebp, %ebp cmpq 0x28(%rsp), %rbx je 0x492c5 movl 0x4(%rbx), %edx leaq 0x78(%rsp), %rdi movq %r15, %rsi callq 0x3dede movq 0x78(%rsp), %rcx movq 0x80(%rsp), %rdx movq 0x48(%r12), %rax movq 0x68(%r12), %rsi vxorps %xmm1, %xmm1, %xmm1 cmpq %rcx, %rdx je 0x49274 movslq (%rdx), %rdi addq $0x8, %rdx vcvtsi2ssl (%rax,%rdi,4), %xmm3, %xmm0 vfmadd231ss (%rsi,%rdi,4), %xmm0, %xmm1 # xmm1 = (xmm0 * mem) + xmm1 movq %rdx, 0x80(%rsp) jmp 0x49253 movq 0x50(%r12), %rcx imulq $0xc, %rbp, %r14 vmovss %xmm1, 0x10(%rsp) movl %ebp, 0x4(%rcx,%r14) movslq (%rbx), %rdx movl (%rax,%rdx,4), %eax movq %r13, %rdx movl %eax, 0x8(%rcx,%r14) movq 0x30(%rsp), %rax movq 0x70(%r12), %rdi movl 0x4(%rax), %esi callq 0x49ffa vsubss 0x10(%rsp), %xmm0, %xmm0 movq 0x50(%r12), %rax addq $0x8, %rbx incq %rbp vmovss %xmm0, (%rax,%r14) jmp 0x4921d movq 0x50(%r12), %rdi movq (%r12), %rdx movl %ebp, %eax imulq $0xc, %rax, %rsi addq %rdi, %rsi callq 0x4a06e imulq $0xc, 0x40(%rsp), %rdx movq 0x58(%r12), %rax movq %rbp, 0x68(%rsp) cmpl $0x0, (%rax,%rdx) movq %rdx, 0x48(%rsp) jle 0x493c3 leal -0x2(%rbp), %eax movabsq $-0x100000000, %r14 # imm = 0xFFFFFFFF00000000 xorl %r15d, %r15d cltq movq %rax, 0x70(%rsp) movq 0x50(%r12), %rax pushq $-0x1 popq %rbx xorl %ebp, %ebp movabsq $0x100000000, %rcx # imm = 0x100000000 movq 0x30(%rsp), %r13 movq 0x18(%rsp), %rdi addl 0x8(%rax,%r15), %ebp addq %rcx, %r14 movq 0x58(%r12), %rcx movslq 0x4(%rax,%r15), %r12 movl (%rcx,%rdx), %ecx movl 0x4(%r13,%r12,8), %esi movl %ecx, 0x10(%rsp) callq 0x369c8 movq 0x20(%rsp), %rax movslq (%r13,%r12,8), %rcx movq 0x20(%rsp), %r12 vmovss 0x410766(%rip), %xmm0 # 0x459ad0 vmovss 0x8(%rsp), %xmm1 movq 0x50(%rax), %rax movq 0x68(%r12), %rdx vmulss (%rax,%r15), %xmm0, %xmm0 vfmadd213ss 0xc(%rsp), %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + mem vaddss (%rdx,%rcx,4), %xmm0, %xmm0 vmovss %xmm0, (%rdx,%rcx,4) movq 0x48(%rsp), %rdx cmpl %ebp, 0x10(%rsp) jle 0x493b1 addq $0xc, %r15 leaq 0x1(%rbx), %rcx cmpq 0x70(%rsp), %rbx movq %rcx, %rbx jl 0x4931c movq 0x58(%r12), %rax sarq $0x20, %r14 cmpl %ebp, (%rax,%rdx) jle 0x493c9 xorl %eax, %eax jmp 0x493d0 xorl %ebp, %ebp pushq $-0x1 popq %r14 cmpl 0x4(%rax,%rdx), %ebp setle %al movslq 0x68(%rsp), %rcx imulq $0xc, %r14, %r15 leaq 0x1(%r14), %rbx movq %rcx, 0x10(%rsp) incq %r14 cmpq 0x10(%rsp), %r14 jae 0x494e5 testb $0x1, %al je 0x494e5 movq 0x50(%r12), %rax movq 0x58(%r12), %rcx addl 0x14(%rax,%r15), %ebp cmpl %ebp, (%rcx,%rdx) jle 0x4941c movslq 0x10(%rax,%r15), %r13 shlq $0x3, %r13 addq 0x30(%rsp), %r13 jmp 0x4948c movslq 0x10(%rax,%r15), %r13 addq %rdx, %rcx shlq $0x3, %r13 addq 0x30(%rsp), %r13 cmpl 0x4(%rcx), %ebp jg 0x4948c vmovss 0xc(%rax,%r15), %xmm0 movq (%r12), %rdi callq 0x3df6c testb %al, %al je 0x4948c movl 0x4(%r13), %esi movq 0x18(%rsp), %rdi callq 0x369c8 movq 0x50(%r12), %rax vmovss 0x41066f(%rip), %xmm0 # 0x459ad0 movq 0x68(%r12), %rcx vmovss 0x8(%rsp), %xmm1 vmulss 0xc(%rax,%r15), %xmm0, %xmm0 movslq (%r13), %rax vfmadd213ss 0xc(%rsp), %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + mem vaddss (%rcx,%rax,4), %xmm0, %xmm0 vmovss %xmm0, (%rcx,%rax,4) movb $0x1, %al jmp 0x494d4 movl 0x4(%r13), %esi movq 0x18(%rsp), %rdi callq 0x36a06 movq 0x50(%r12), %rax vmovss 0x410629(%rip), %xmm0 # 0x459ad0 movq 0x68(%r12), %rcx vmovss 0x8(%rsp), %xmm1 vmulss 0xc(%rax,%r15), %xmm0, %xmm0 movslq (%r13), %rax vfmadd213ss 0xc(%rsp), %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + mem vmovss (%rcx,%rax,4), %xmm1 vsubss %xmm0, %xmm1, %xmm0 vmovss %xmm0, (%rcx,%rax,4) xorl %eax, %eax movq 0x48(%rsp), %rdx addq $0xc, %r15 incq %rbx jmp 0x493e2 movq 0x18(%rsp), %r13 cmpq 0x10(%rsp), %rbx jae 0x4955b movq 0x50(%r12), %rax movq 0x30(%rsp), %r14 movq %r13, %rdi movslq 0x10(%rax,%r15), %r12 movl 0x4(%r14,%r12,8), %esi callq 0x36a06 movq 0x20(%rsp), %rax movq 0x20(%rsp), %rcx vmovss 0x4105b1(%rip), %xmm0 # 0x459ad0 vmovss 0x8(%rsp), %xmm1 incq %rbx movq 0x50(%rax), %rax movq 0x68(%rcx), %rcx vmulss 0xc(%rax,%r15), %xmm0, %xmm0 movslq (%r14,%r12,8), %rax movq 0x20(%rsp), %r12 addq $0xc, %r15 vfmadd213ss 0xc(%rsp), %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + mem vmovss (%rcx,%rax,4), %xmm1 vsubss %xmm0, %xmm1, %xmm0 vmovss %xmm0, (%rcx,%rax,4) jmp 0x494ea movq 0x40(%rsp), %rsi movq %r12, %rdi movq %r13, %rdx callq 0x48c81 testb %al, %al je 0x495b7 movq 0x60(%rsp), %rdx movq 0x50(%rsp), %r15 addq $0x4, %rdx jmp 0x491c9 xorl %eax, %eax addq $0x88, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq leaq 0x40ec41(%rip), %rdi # 0x4581de leaq 0x410ed6(%rip), %rsi # 0x45a47a leaq 0x410c9c(%rip), %rdx # 0x45a247 leaq 0x410ece(%rip), %rcx # 0x45a480 callq 0x2813f leaq 0x40ec20(%rip), %rdi # 0x4581de leaq 0x410ebf(%rip), %rsi # 0x45a484 leaq 0x410c7b(%rip), %rdx # 0x45a247 leaq 0x410ed2(%rip), %rcx # 0x45a4a5 callq 0x2813f
/quesnel[P]baryonyx/lib/src/random-solver.cpp
bool baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>>::compute_update_row<baryonyx::bit_array, __gnu_cxx::__normal_iterator<std::pair<int, int> const*, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>>>>(baryonyx::bit_array&, __gnu_cxx::__normal_iterator<std::pair<int, int> const*, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>>>, __gnu_cxx::__normal_iterator<std::pair<int, int> const*, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>>>, float, float, float)
bool compute_update_row(Xtype& x, Iterator first, Iterator last, Float kappa, Float delta, Float theta) { for (; first != last; ++first) { auto k = constraint(first); bx_expects(k < m); auto [row_begin, row_end] = ap.row(k); decrease_preference(row_begin, row_end, theta); int r_size = 0; for (auto it = row_begin; it != row_end; ++it, ++r_size) { Float sum_a_p = 0; auto [col_begin, col_end] = ap.column(it->column); for (; col_begin != col_end; ++col_begin) sum_a_p += static_cast<Float>(A[col_begin->value]) * P[col_begin->value]; R[r_size].id = r_size; R[r_size].a = A[it->value]; R[r_size].value = c(row_begin->column, x) - sum_a_p; } calculator_sort<Mode>(R.get(), R.get() + r_size, rng); int value = 0; bool valid = b[k].min <= 0; int i = -1; // if (!valid) { // do { // ++i; // value += R[i].a; // valid = b[k].min <= value; // } while (!valid && i + 1 < r_size); // } // valid = b[k].min <= value && value <= b[k].max; // while (i + 1 < r_size && valid) { // ++i; // value += R[i].a; // valid = b[k].min <= value && value <= b[k].max; // } // std::uniform_real_distribution<Float> real_dist(Float{ 0 }, // Float{ 1 }); // auto selected = i; // auto d = delta; // if (selected < 0) { // d += (kappa / (one - kappa)) * (R[0].value / two); // d *= real_dist(rng); // for (i = 0; i != r_size; ++i) { // auto var = row_begin + R[i].id; // if (R[i].is_negative()) { // x.set(var->column, 1); // P[var->value] += d; // } else { // x.set(var->column, 0); // P[var->value] -= d; // } // } // } else if (selected + 1 >= r_size) { // d += (kappa / (one - kappa)) * (R[selected].value * middle); // d *= real_dist(rng); // for (i = 0; i != r_size; ++i) { // auto var = row_begin + R[i].id; // if (R[i].is_negative()) { // x.set(var->column, 0); // P[var->value] -= d; // } else { // x.set(var->column, 1); // P[var->value] += d; // } // } // } else { // d += (kappa / (one - kappa)) * // (R[selected + 1].value - R[selected].value); // d *= real_dist(rng); // for (i = 0; i <= selected; ++i) { // auto var = row_begin + R[i].id; // if (R[i].is_negative()) { // x.set(var->column, 0); // P[var->value] -= d; // } else { // x.set(var->column, 1); // P[var->value] += d; // } // } // for (; i != r_size; ++i) { // auto var = row_begin + R[i].id; // if (R[i].is_negative()) { // x.set(var->column, 1); // P[var->value] += d; // } else { // x.set(var->column, 0); // P[var->value] -= d; // } // } constexpr Float one{ 1 }; constexpr Float two{ 2 }; if (!valid) { do { ++i; value += R[i].a; valid = b[k].min <= value; auto var = row_begin + R[i].id; x.set(var->column); P[var->value] += delta + (kappa / (one - kappa)) * (R[i].value / two); } while (!valid && i + 1 < r_size); } valid = b[k].min <= value && value <= b[k].max; while (i + 1 < r_size && valid) { ++i; value += R[i].a; valid = b[k].min <= value && value <= b[k].max; auto var = row_begin + R[i].id; if (valid) valid = stop_iterating<Mode>(R[i].value, rng); if (valid) { x.set(var->column); P[var->value] += delta + (kappa / (one - kappa)) * (R[i].value / two); } else { x.unset(var->column); P[var->value] -= delta + (kappa / (one - kappa)) * (R[i].value / two); } } while (i + 1 < r_size) { ++i; auto var = row_begin + R[i].id; x.unset(var->column); P[var->value] -= delta + (kappa / (one - kappa)) * (R[i].value / two); } bx_expects(is_valid_constraint(*this, k, x)); } return false; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x88, %rsp vmovss %xmm1, 0xc(%rsp) vmovss 0x4104cd(%rip), %xmm1 # 0x459ac4 leaq 0x8(%rdi), %r15 vmovss %xmm2, 0x3c(%rsp) movq %rcx, 0x58(%rsp) movq %rsi, %r13 movq %rdi, %r12 movq %rdi, 0x20(%rsp) movq %rsi, 0x18(%rsp) movq %r15, 0x50(%rsp) vsubss %xmm0, %xmm1, %xmm1 vdivss %xmm1, %xmm0, %xmm0 vmovss %xmm0, 0x8(%rsp) cmpq 0x58(%rsp), %rdx je 0x499e2 movslq (%rdx), %rax cmpl 0x80(%r12), %eax jge 0x499f6 leaq 0x28(%rsp), %rdi movq %rdx, 0x60(%rsp) movq %r15, %rsi movl %eax, %edx movq %rax, 0x40(%rsp) callq 0x3de66 vmovss 0x3c(%rsp), %xmm0 movq 0x28(%rsp), %rdx movq 0x30(%rsp), %rsi movq %r12, %rdi callq 0x49fdc movq 0x30(%rsp), %rbx xorl %ebp, %ebp cmpq 0x28(%rsp), %rbx je 0x49725 movl 0x4(%rbx), %edx leaq 0x78(%rsp), %rdi movq %r15, %rsi callq 0x3dede movq 0x78(%rsp), %rcx movq 0x80(%rsp), %rdx movq 0x48(%r12), %rax movq 0x68(%r12), %rsi vxorps %xmm1, %xmm1, %xmm1 cmpq %rcx, %rdx je 0x496d4 movslq (%rdx), %rdi addq $0x8, %rdx vcvtsi2ssl (%rax,%rdi,4), %xmm3, %xmm0 vfmadd231ss (%rsi,%rdi,4), %xmm0, %xmm1 # xmm1 = (xmm0 * mem) + xmm1 movq %rdx, 0x80(%rsp) jmp 0x496b3 movq 0x50(%r12), %rcx imulq $0xc, %rbp, %r14 vmovss %xmm1, 0x10(%rsp) movl %ebp, 0x4(%rcx,%r14) movslq (%rbx), %rdx movl (%rax,%rdx,4), %eax movq %r13, %rdx movl %eax, 0x8(%rcx,%r14) movq 0x30(%rsp), %rax movq 0x70(%r12), %rdi movl 0x4(%rax), %esi callq 0x49ffa vsubss 0x10(%rsp), %xmm0, %xmm0 movq 0x50(%r12), %rax addq $0x8, %rbx incq %rbp vmovss %xmm0, (%rax,%r14) jmp 0x4967d movq 0x50(%r12), %rdi movq (%r12), %rdx movl %ebp, %eax imulq $0xc, %rax, %rsi addq %rdi, %rsi callq 0x4a06e imulq $0xc, 0x40(%rsp), %rdx movq 0x58(%r12), %rax movq %rbp, 0x68(%rsp) cmpl $0x0, (%rax,%rdx) movq %rdx, 0x48(%rsp) jle 0x49823 leal -0x2(%rbp), %eax movabsq $-0x100000000, %r14 # imm = 0xFFFFFFFF00000000 xorl %r15d, %r15d cltq movq %rax, 0x70(%rsp) movq 0x50(%r12), %rax pushq $-0x1 popq %rbx xorl %ebp, %ebp movabsq $0x100000000, %rcx # imm = 0x100000000 movq 0x30(%rsp), %r13 movq 0x18(%rsp), %rdi addl 0x8(%rax,%r15), %ebp addq %rcx, %r14 movq 0x58(%r12), %rcx movslq 0x4(%rax,%r15), %r12 movl (%rcx,%rdx), %ecx movl 0x4(%r13,%r12,8), %esi movl %ecx, 0x10(%rsp) callq 0x369c8 movq 0x20(%rsp), %rax movslq (%r13,%r12,8), %rcx movq 0x20(%rsp), %r12 vmovss 0x410306(%rip), %xmm0 # 0x459ad0 vmovss 0x8(%rsp), %xmm1 movq 0x50(%rax), %rax movq 0x68(%r12), %rdx vmulss (%rax,%r15), %xmm0, %xmm0 vfmadd213ss 0xc(%rsp), %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + mem vaddss (%rdx,%rcx,4), %xmm0, %xmm0 vmovss %xmm0, (%rdx,%rcx,4) movq 0x48(%rsp), %rdx cmpl %ebp, 0x10(%rsp) jle 0x49811 addq $0xc, %r15 leaq 0x1(%rbx), %rcx cmpq 0x70(%rsp), %rbx movq %rcx, %rbx jl 0x4977c movq 0x58(%r12), %rax sarq $0x20, %r14 cmpl %ebp, (%rax,%rdx) jle 0x49829 xorl %eax, %eax jmp 0x49830 xorl %ebp, %ebp pushq $-0x1 popq %r14 cmpl 0x4(%rax,%rdx), %ebp setle %al movslq 0x68(%rsp), %rcx imulq $0xc, %r14, %r15 leaq 0x1(%r14), %rbx movq %rcx, 0x10(%rsp) incq %r14 cmpq 0x10(%rsp), %r14 jae 0x49945 testb $0x1, %al je 0x49945 movq 0x50(%r12), %rax movq 0x58(%r12), %rcx addl 0x14(%rax,%r15), %ebp cmpl %ebp, (%rcx,%rdx) jle 0x4987c movslq 0x10(%rax,%r15), %r13 shlq $0x3, %r13 addq 0x30(%rsp), %r13 jmp 0x498ec movslq 0x10(%rax,%r15), %r13 addq %rdx, %rcx shlq $0x3, %r13 addq 0x30(%rsp), %r13 cmpl 0x4(%rcx), %ebp jg 0x498ec vmovss 0xc(%rax,%r15), %xmm0 movq (%r12), %rdi callq 0x3df6c testb %al, %al je 0x498ec movl 0x4(%r13), %esi movq 0x18(%rsp), %rdi callq 0x369c8 movq 0x50(%r12), %rax vmovss 0x41020f(%rip), %xmm0 # 0x459ad0 movq 0x68(%r12), %rcx vmovss 0x8(%rsp), %xmm1 vmulss 0xc(%rax,%r15), %xmm0, %xmm0 movslq (%r13), %rax vfmadd213ss 0xc(%rsp), %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + mem vaddss (%rcx,%rax,4), %xmm0, %xmm0 vmovss %xmm0, (%rcx,%rax,4) movb $0x1, %al jmp 0x49934 movl 0x4(%r13), %esi movq 0x18(%rsp), %rdi callq 0x36a06 movq 0x50(%r12), %rax vmovss 0x4101c9(%rip), %xmm0 # 0x459ad0 movq 0x68(%r12), %rcx vmovss 0x8(%rsp), %xmm1 vmulss 0xc(%rax,%r15), %xmm0, %xmm0 movslq (%r13), %rax vfmadd213ss 0xc(%rsp), %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + mem vmovss (%rcx,%rax,4), %xmm1 vsubss %xmm0, %xmm1, %xmm0 vmovss %xmm0, (%rcx,%rax,4) xorl %eax, %eax movq 0x48(%rsp), %rdx addq $0xc, %r15 incq %rbx jmp 0x49842 movq 0x18(%rsp), %r13 cmpq 0x10(%rsp), %rbx jae 0x499bb movq 0x50(%r12), %rax movq 0x30(%rsp), %r14 movq %r13, %rdi movslq 0x10(%rax,%r15), %r12 movl 0x4(%r14,%r12,8), %esi callq 0x36a06 movq 0x20(%rsp), %rax movq 0x20(%rsp), %rcx vmovss 0x410151(%rip), %xmm0 # 0x459ad0 vmovss 0x8(%rsp), %xmm1 incq %rbx movq 0x50(%rax), %rax movq 0x68(%rcx), %rcx vmulss 0xc(%rax,%r15), %xmm0, %xmm0 movslq (%r14,%r12,8), %rax movq 0x20(%rsp), %r12 addq $0xc, %r15 vfmadd213ss 0xc(%rsp), %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + mem vmovss (%rcx,%rax,4), %xmm1 vsubss %xmm0, %xmm1, %xmm0 vmovss %xmm0, (%rcx,%rax,4) jmp 0x4994a movq 0x40(%rsp), %rsi movq %r12, %rdi movq %r13, %rdx callq 0x48c81 testb %al, %al je 0x49a17 movq 0x60(%rsp), %rdx movq 0x50(%rsp), %r15 addq $0x8, %rdx jmp 0x49629 xorl %eax, %eax addq $0x88, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq leaq 0x40e7e1(%rip), %rdi # 0x4581de leaq 0x410a76(%rip), %rsi # 0x45a47a leaq 0x41083c(%rip), %rdx # 0x45a247 leaq 0x410a6e(%rip), %rcx # 0x45a480 callq 0x2813f leaq 0x40e7c0(%rip), %rdi # 0x4581de leaq 0x410a5f(%rip), %rsi # 0x45a484 leaq 0x41081b(%rip), %rdx # 0x45a247 leaq 0x410a72(%rip), %rcx # 0x45a4a5 callq 0x2813f
/quesnel[P]baryonyx/lib/src/random-solver.cpp
int baryonyx::itm::compute_order::infeasibility_local_compute_violated_constraints<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>>, baryonyx::bit_array>(baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>>&, baryonyx::bit_array const&)
int infeasibility_local_compute_violated_constraints(Solver& solver, const Xtype& x) { m_order.clear(); for (int k = 0, e = solver.m; k != e; ++k) { sparse_matrix<int>::const_row_iterator it, et; std::tie(it, et) = solver.ap.row(k); int v = 0; for (; it != et; ++it) v += solver.factor(it->value) * x[it->column]; if (solver.bound_min(k) > v) m_order.push_back(std::make_pair(k, solver.bound_min(k) - v)); else if (solver.bound_max(k) < v) m_order.push_back(std::make_pair(k, v - solver.bound_max(k))); } return length(m_order); }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x38, %rsp movq 0x18(%rdi), %rax movq %rdx, %r14 movq %rsi, %r15 cmpq %rax, 0x20(%rdi) je 0x49a5a movq %rax, 0x20(%rdi) leaq 0x18(%rdi), %rax leaq 0x8(%r15), %rcx xorl %r12d, %r12d movq %rdi, 0x20(%rsp) movq %rax, 0x10(%rsp) movl 0x80(%r15), %eax movq %rcx, 0x18(%rsp) movq %rax, 0x28(%rsp) cmpq 0x28(%rsp), %r12 je 0x49b1f movq 0x18(%rsp), %rsi movq %rsp, %rdi movl %r12d, %edx movq %r12, 0x30(%rsp) callq 0x3de66 movq (%rsp), %r13 movq 0x8(%rsp), %r12 xorl %ebx, %ebx cmpq %r13, %r12 je 0x49ad3 movslq (%r12), %rax movq 0x48(%r15), %rcx movl 0x4(%r12), %esi movq %r14, %rdi movl (%rcx,%rax,4), %ebp callq 0x3664a imull %ebp, %eax addq $0x8, %r12 addl %eax, %ebx jmp 0x49aab movq 0x30(%rsp), %r12 movq 0x58(%r15), %rcx imulq $0xc, %r12, %rdx movl (%rcx,%rdx), %eax subl %ebx, %eax jle 0x49af4 shlq $0x20, %rax orq %r12, %rax movq %rax, (%rsp) jmp 0x49b05 subl 0x4(%rcx,%rdx), %ebx jle 0x49b12 shlq $0x20, %rbx orq %r12, %rbx movq %rbx, (%rsp) movq 0x10(%rsp), %rdi movq %rsp, %rsi callq 0x3c8c2 movq 0x20(%rsp), %rdi incq %r12 jmp 0x49a80 movq 0x20(%rdi), %rax subq 0x18(%rdi), %rax shrq $0x3, %rax addq $0x38, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq
/quesnel[P]baryonyx/lib/src/itm-common.hpp
bool baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>>::compute_update_row<baryonyx::bit_array, __gnu_cxx::__normal_iterator<int const*, std::vector<int, std::allocator<int>>>>(baryonyx::bit_array&, __gnu_cxx::__normal_iterator<int const*, std::vector<int, std::allocator<int>>>, __gnu_cxx::__normal_iterator<int const*, std::vector<int, std::allocator<int>>>, float, float, float)
bool compute_update_row(Xtype& x, Iterator first, Iterator last, Float kappa, Float delta, Float theta) { for (; first != last; ++first) { auto k = constraint(first); bx_expects(k < m); auto [row_begin, row_end] = ap.row(k); decrease_preference(row_begin, row_end, theta); int r_size = 0; for (auto it = row_begin; it != row_end; ++it, ++r_size) { Float sum_a_p = 0; auto [col_begin, col_end] = ap.column(it->column); for (; col_begin != col_end; ++col_begin) sum_a_p += static_cast<Float>(A[col_begin->value]) * P[col_begin->value]; R[r_size].id = r_size; R[r_size].a = A[it->value]; R[r_size].value = c(row_begin->column, x) - sum_a_p; } calculator_sort<Mode>(R.get(), R.get() + r_size, rng); int value = 0; bool valid = b[k].min <= 0; int i = -1; // if (!valid) { // do { // ++i; // value += R[i].a; // valid = b[k].min <= value; // } while (!valid && i + 1 < r_size); // } // valid = b[k].min <= value && value <= b[k].max; // while (i + 1 < r_size && valid) { // ++i; // value += R[i].a; // valid = b[k].min <= value && value <= b[k].max; // } // std::uniform_real_distribution<Float> real_dist(Float{ 0 }, // Float{ 1 }); // auto selected = i; // auto d = delta; // if (selected < 0) { // d += (kappa / (one - kappa)) * (R[0].value / two); // d *= real_dist(rng); // for (i = 0; i != r_size; ++i) { // auto var = row_begin + R[i].id; // if (R[i].is_negative()) { // x.set(var->column, 1); // P[var->value] += d; // } else { // x.set(var->column, 0); // P[var->value] -= d; // } // } // } else if (selected + 1 >= r_size) { // d += (kappa / (one - kappa)) * (R[selected].value * middle); // d *= real_dist(rng); // for (i = 0; i != r_size; ++i) { // auto var = row_begin + R[i].id; // if (R[i].is_negative()) { // x.set(var->column, 0); // P[var->value] -= d; // } else { // x.set(var->column, 1); // P[var->value] += d; // } // } // } else { // d += (kappa / (one - kappa)) * // (R[selected + 1].value - R[selected].value); // d *= real_dist(rng); // for (i = 0; i <= selected; ++i) { // auto var = row_begin + R[i].id; // if (R[i].is_negative()) { // x.set(var->column, 0); // P[var->value] -= d; // } else { // x.set(var->column, 1); // P[var->value] += d; // } // } // for (; i != r_size; ++i) { // auto var = row_begin + R[i].id; // if (R[i].is_negative()) { // x.set(var->column, 1); // P[var->value] += d; // } else { // x.set(var->column, 0); // P[var->value] -= d; // } // } constexpr Float one{ 1 }; constexpr Float two{ 2 }; if (!valid) { do { ++i; value += R[i].a; valid = b[k].min <= value; auto var = row_begin + R[i].id; x.set(var->column); P[var->value] += delta + (kappa / (one - kappa)) * (R[i].value / two); } while (!valid && i + 1 < r_size); } valid = b[k].min <= value && value <= b[k].max; while (i + 1 < r_size && valid) { ++i; value += R[i].a; valid = b[k].min <= value && value <= b[k].max; auto var = row_begin + R[i].id; if (valid) valid = stop_iterating<Mode>(R[i].value, rng); if (valid) { x.set(var->column); P[var->value] += delta + (kappa / (one - kappa)) * (R[i].value / two); } else { x.unset(var->column); P[var->value] -= delta + (kappa / (one - kappa)) * (R[i].value / two); } } while (i + 1 < r_size) { ++i; auto var = row_begin + R[i].id; x.unset(var->column); P[var->value] -= delta + (kappa / (one - kappa)) * (R[i].value / two); } bx_expects(is_valid_constraint(*this, k, x)); } return false; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x88, %rsp vmovss %xmm1, 0xc(%rsp) vmovss 0x40ff6b(%rip), %xmm1 # 0x459ac4 leaq 0x8(%rdi), %r15 vmovss %xmm2, 0x3c(%rsp) movq %rcx, 0x58(%rsp) movq %rsi, %r13 movq %rdi, %r12 movq %rdi, 0x20(%rsp) movq %rsi, 0x18(%rsp) movq %r15, 0x50(%rsp) vsubss %xmm0, %xmm1, %xmm1 vdivss %xmm1, %xmm0, %xmm0 vmovss %xmm0, 0x8(%rsp) cmpq 0x58(%rsp), %rdx je 0x49f44 movslq (%rdx), %rax cmpl 0x80(%r12), %eax jge 0x49f58 leaq 0x28(%rsp), %rdi movq %rdx, 0x60(%rsp) movq %r15, %rsi movl %eax, %edx movq %rax, 0x40(%rsp) callq 0x3de66 vmovss 0x3c(%rsp), %xmm0 movq 0x28(%rsp), %rdx movq 0x30(%rsp), %rsi movq %r12, %rdi callq 0x49fdc movq 0x30(%rsp), %rbx xorl %ebp, %ebp cmpq 0x28(%rsp), %rbx je 0x49c87 movl 0x4(%rbx), %edx leaq 0x78(%rsp), %rdi movq %r15, %rsi callq 0x3dede movq 0x78(%rsp), %rcx movq 0x80(%rsp), %rdx movq 0x48(%r12), %rax movq 0x68(%r12), %rsi vxorps %xmm1, %xmm1, %xmm1 cmpq %rcx, %rdx je 0x49c36 movslq (%rdx), %rdi addq $0x8, %rdx vcvtsi2ssl (%rax,%rdi,4), %xmm3, %xmm0 vfmadd231ss (%rsi,%rdi,4), %xmm0, %xmm1 # xmm1 = (xmm0 * mem) + xmm1 movq %rdx, 0x80(%rsp) jmp 0x49c15 movq 0x50(%r12), %rcx imulq $0xc, %rbp, %r14 vmovss %xmm1, 0x10(%rsp) movl %ebp, 0x4(%rcx,%r14) movslq (%rbx), %rdx movl (%rax,%rdx,4), %eax movq %r13, %rdx movl %eax, 0x8(%rcx,%r14) movq 0x30(%rsp), %rax movq 0x70(%r12), %rdi movl 0x4(%rax), %esi callq 0x49ffa vsubss 0x10(%rsp), %xmm0, %xmm0 movq 0x50(%r12), %rax addq $0x8, %rbx incq %rbp vmovss %xmm0, (%rax,%r14) jmp 0x49bdf movq 0x50(%r12), %rdi movq (%r12), %rdx movl %ebp, %eax imulq $0xc, %rax, %rsi addq %rdi, %rsi callq 0x4a06e imulq $0xc, 0x40(%rsp), %rdx movq 0x58(%r12), %rax movq %rbp, 0x68(%rsp) cmpl $0x0, (%rax,%rdx) movq %rdx, 0x48(%rsp) jle 0x49d85 leal -0x2(%rbp), %eax movabsq $-0x100000000, %r14 # imm = 0xFFFFFFFF00000000 xorl %r15d, %r15d cltq movq %rax, 0x70(%rsp) movq 0x50(%r12), %rax pushq $-0x1 popq %rbx xorl %ebp, %ebp movabsq $0x100000000, %rcx # imm = 0x100000000 movq 0x30(%rsp), %r13 movq 0x18(%rsp), %rdi addl 0x8(%rax,%r15), %ebp addq %rcx, %r14 movq 0x58(%r12), %rcx movslq 0x4(%rax,%r15), %r12 movl (%rcx,%rdx), %ecx movl 0x4(%r13,%r12,8), %esi movl %ecx, 0x10(%rsp) callq 0x369c8 movq 0x20(%rsp), %rax movslq (%r13,%r12,8), %rcx movq 0x20(%rsp), %r12 vmovss 0x40fda4(%rip), %xmm0 # 0x459ad0 vmovss 0x8(%rsp), %xmm1 movq 0x50(%rax), %rax movq 0x68(%r12), %rdx vmulss (%rax,%r15), %xmm0, %xmm0 vfmadd213ss 0xc(%rsp), %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + mem vaddss (%rdx,%rcx,4), %xmm0, %xmm0 vmovss %xmm0, (%rdx,%rcx,4) movq 0x48(%rsp), %rdx cmpl %ebp, 0x10(%rsp) jle 0x49d73 addq $0xc, %r15 leaq 0x1(%rbx), %rcx cmpq 0x70(%rsp), %rbx movq %rcx, %rbx jl 0x49cde movq 0x58(%r12), %rax sarq $0x20, %r14 cmpl %ebp, (%rax,%rdx) jle 0x49d8b xorl %eax, %eax jmp 0x49d92 xorl %ebp, %ebp pushq $-0x1 popq %r14 cmpl 0x4(%rax,%rdx), %ebp setle %al movslq 0x68(%rsp), %rcx imulq $0xc, %r14, %r15 leaq 0x1(%r14), %rbx movq %rcx, 0x10(%rsp) incq %r14 cmpq 0x10(%rsp), %r14 jae 0x49ea7 testb $0x1, %al je 0x49ea7 movq 0x50(%r12), %rax movq 0x58(%r12), %rcx addl 0x14(%rax,%r15), %ebp cmpl %ebp, (%rcx,%rdx) jle 0x49dde movslq 0x10(%rax,%r15), %r13 shlq $0x3, %r13 addq 0x30(%rsp), %r13 jmp 0x49e4e movslq 0x10(%rax,%r15), %r13 addq %rdx, %rcx shlq $0x3, %r13 addq 0x30(%rsp), %r13 cmpl 0x4(%rcx), %ebp jg 0x49e4e vmovss 0xc(%rax,%r15), %xmm0 movq (%r12), %rdi callq 0x3df6c testb %al, %al je 0x49e4e movl 0x4(%r13), %esi movq 0x18(%rsp), %rdi callq 0x369c8 movq 0x50(%r12), %rax vmovss 0x40fcad(%rip), %xmm0 # 0x459ad0 movq 0x68(%r12), %rcx vmovss 0x8(%rsp), %xmm1 vmulss 0xc(%rax,%r15), %xmm0, %xmm0 movslq (%r13), %rax vfmadd213ss 0xc(%rsp), %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + mem vaddss (%rcx,%rax,4), %xmm0, %xmm0 vmovss %xmm0, (%rcx,%rax,4) movb $0x1, %al jmp 0x49e96 movl 0x4(%r13), %esi movq 0x18(%rsp), %rdi callq 0x36a06 movq 0x50(%r12), %rax vmovss 0x40fc67(%rip), %xmm0 # 0x459ad0 movq 0x68(%r12), %rcx vmovss 0x8(%rsp), %xmm1 vmulss 0xc(%rax,%r15), %xmm0, %xmm0 movslq (%r13), %rax vfmadd213ss 0xc(%rsp), %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + mem vmovss (%rcx,%rax,4), %xmm1 vsubss %xmm0, %xmm1, %xmm0 vmovss %xmm0, (%rcx,%rax,4) xorl %eax, %eax movq 0x48(%rsp), %rdx addq $0xc, %r15 incq %rbx jmp 0x49da4 movq 0x18(%rsp), %r13 cmpq 0x10(%rsp), %rbx jae 0x49f1d movq 0x50(%r12), %rax movq 0x30(%rsp), %r14 movq %r13, %rdi movslq 0x10(%rax,%r15), %r12 movl 0x4(%r14,%r12,8), %esi callq 0x36a06 movq 0x20(%rsp), %rax movq 0x20(%rsp), %rcx vmovss 0x40fbef(%rip), %xmm0 # 0x459ad0 vmovss 0x8(%rsp), %xmm1 incq %rbx movq 0x50(%rax), %rax movq 0x68(%rcx), %rcx vmulss 0xc(%rax,%r15), %xmm0, %xmm0 movslq (%r14,%r12,8), %rax movq 0x20(%rsp), %r12 addq $0xc, %r15 vfmadd213ss 0xc(%rsp), %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + mem vmovss (%rcx,%rax,4), %xmm1 vsubss %xmm0, %xmm1, %xmm0 vmovss %xmm0, (%rcx,%rax,4) jmp 0x49eac movq 0x40(%rsp), %rsi movq %r12, %rdi movq %r13, %rdx callq 0x48c81 testb %al, %al je 0x49f79 movq 0x60(%rsp), %rdx movq 0x50(%rsp), %r15 addq $0x4, %rdx jmp 0x49b8b xorl %eax, %eax addq $0x88, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq leaq 0x40e27f(%rip), %rdi # 0x4581de leaq 0x410514(%rip), %rsi # 0x45a47a leaq 0x4102da(%rip), %rdx # 0x45a247 leaq 0x41050c(%rip), %rcx # 0x45a480 callq 0x2813f leaq 0x40e25e(%rip), %rdi # 0x4581de leaq 0x4104fd(%rip), %rsi # 0x45a484 leaq 0x4102b9(%rip), %rdx # 0x45a247 leaq 0x410510(%rip), %rcx # 0x45a4a5 callq 0x2813f
/quesnel[P]baryonyx/lib/src/random-solver.cpp
int baryonyx::itm::compute_order::local_compute_violated_constraints<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>>, baryonyx::bit_array>(baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>> const&, baryonyx::bit_array const&)
int local_compute_violated_constraints(const Solver& slv, const Xtype& x) { int remaining = 0; for (int k = 0; k != slv.m; ++k) if (!is_valid_constraint(slv, k, x)) ++remaining; return remaining; }
pushq %rbp pushq %r15 pushq %r14 pushq %rbx pushq %rax movq %rdx, %rbx movq %rsi, %r14 xorl %ebp, %ebp xorl %r15d, %r15d cmpl 0x80(%r14), %r15d je 0x49fcf movq %r14, %rdi movl %r15d, %esi movq %rbx, %rdx callq 0x48c81 xorb $0x1, %al incl %r15d movzbl %al, %eax addl %eax, %ebp jmp 0x49fac movl %ebp, %eax addq $0x8, %rsp popq %rbx popq %r14 popq %r15 popq %rbp retq
/quesnel[P]baryonyx/lib/src/itm-common.hpp
void baryonyx::itm::random_shuffle_unique<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>>::rc_data*>(baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>>::rc_data*, baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>>::rc_data*, std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>&)
inline void random_shuffle_unique(iteratorT begin, iteratorT end, random_engine& rng) noexcept { auto ret = begin++; for (; begin != end; ++begin) { if (ret->value != begin->value) { std::shuffle(ret, begin, rng); ret = begin; } } std::shuffle(ret, begin, rng); }
pushq %r15 pushq %r14 pushq %rbx movq %rdx, %rbx movq %rsi, %r14 leaq 0xc(%rdi), %rsi cmpq %r14, %rsi je 0x4a0dc vmovss (%rdi), %xmm0 leaq 0xc(%rsi), %r15 vucomiss (%rsi), %xmm0 movq %r15, %rsi jne 0x4a0c8 jnp 0x4a0b0 addq $-0xc, %r15 movq %r15, %rsi movq %rbx, %rdx callq 0x4a672 movq %r15, %rdi jmp 0x4a0ac movq %rbx, %rdx callq 0x4a672 popq %rbx popq %r14 popq %r15 retq jmp 0x4a0ec movq %rax, %rdi callq 0xeb9f
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::itm::storage<baryonyx::itm::quadratic_cost_type<float>, baryonyx::itm::maximize_tag>::can_be_inserted(unsigned long, double) const
bool can_be_inserted([[maybe_unused]] const std::size_t hash, const double value) const noexcept { m_indices_reader lock(m_indices_mutex); for (int i = 0; i != m_size; ++i) if (m_data[i].remaining_constraints == 0 && m_data[i].value == value && m_data[i].hash == hash) return false; return true; }
pushq %r14 pushq %rbx subq $0x18, %rsp movq %rdi, 0x8(%rsp) vmovsd %xmm0, (%rsp) movq %rsi, %rbx movq %rdi, %r14 movb $0x1, 0x10(%rsp) callq 0x3c460 movl 0x98(%r14), %eax vmovsd (%rsp), %xmm1 movq 0x50(%r14), %rcx xorl %edx, %edx imulq $0x38, %rax, %rax cmpq %rdx, %rax je 0x4bb68 cmpl $0x0, 0x30(%rcx,%rdx) jne 0x4bb62 vmovsd 0x10(%rcx,%rdx), %xmm0 vucomisd %xmm1, %xmm0 jne 0x4bb62 jp 0x4bb62 cmpq %rbx, 0x20(%rcx,%rdx) je 0x4bb68 addq $0x38, %rdx jmp 0x4bb41 cmpq %rdx, %rax leaq 0x8(%rsp), %rdi sete %bl callq 0x3c450 movl %ebx, %eax addq $0x18, %rsp popq %rbx popq %r14 retq movq %rax, %rdi callq 0xeb9f
/quesnel[P]baryonyx/lib/src/itm-optimizer-common.hpp
baryonyx::itm::storage<baryonyx::itm::quadratic_cost_type<float>, baryonyx::itm::maximize_tag>::insert(baryonyx::itm::local_context&, baryonyx::bit_array const&, unsigned long, int, double, long)
void insert(local_context& ctx, const bit_array& x, const std::size_t hash, const int remaining_constraints, const double duration, const long int loop) noexcept { to_log(stdout, 5u, "- insert advance {} (hash: {}) {}s in {} loops\n", remaining_constraints, hash, duration, loop); int id_to_delete = m_indices[choose_a_bad_solution(ctx)]; to_log(stdout, 5u, "- delete {} ({})\n", id_to_delete, m_data[id_to_delete].value); replace_result(id_to_delete, x, costs.results(x, cost_constant), duration, hash, loop, remaining_constraints); sort(); }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x28, %rsp movq 0x5f123f(%rip), %r12 # 0x63cfc8 movq %rdi, %rbx leaq 0x20(%rsp), %rax leaq 0xc(%rsp), %r10 leaq 0x18(%rsp), %r11 leaq 0x10(%rsp), %r13 movq %rdx, %r14 movq %rsi, %r15 movq %rcx, (%rax) movl %r8d, (%r10) vmovsd %xmm0, (%r11) movq %r9, (%r13) movq (%r12), %rdi leaq 0x40e74d(%rip), %rcx # 0x45a50d pushq $0x5 popq %rsi pushq $0x2f popq %rdx movq %r10, %r8 movq %rax, %r9 pushq %r13 pushq %r11 callq 0x3ff5c popq %rax popq %rcx leaq 0x68(%r15), %rdi movq %r15, %rsi callq 0x3fce2 movq 0x38(%rbx), %rcx cltq leaq 0x8(%rsp), %r8 movq (%r12), %rdi movslq (%rcx,%rax,4), %rax movl %eax, (%r8) imulq $0x38, %rax, %rax movq 0x50(%rbx), %rcx leaq 0x10(%rcx,%rax), %r9 leaq 0x40e6ee(%rip), %rcx # 0x45a4fb pushq $0x5 popq %rsi pushq $0x11 popq %rdx callq 0x3c388 vmovsd 0x90(%rbx), %xmm0 movl 0x8(%rsp), %ebp movq 0x88(%rbx), %rdi movq %r14, %rsi callq 0x45118 vmovsd 0x18(%rsp), %xmm1 movq 0x20(%rsp), %rcx movq 0x10(%rsp), %r8 movl 0xc(%rsp), %r9d movq %rbx, %rdi movl %ebp, %esi movq %r14, %rdx callq 0x4bc6c movq %rbx, %rdi callq 0x451fc addq $0x28, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq movq %rax, %rdi callq 0xeb9f
/quesnel[P]baryonyx/lib/src/itm-optimizer-common.hpp
baryonyx::itm::storage<baryonyx::itm::quadratic_cost_type<float>, baryonyx::itm::maximize_tag>::get_best(int&, double&, double&, long&) const
void get_best(int& constraints_remaining, double& value, double& duration, long int& loop) const noexcept { m_indices_reader lock(m_indices_mutex); int id = m_indices.front(); constraints_remaining = m_data[id].remaining_constraints; value = m_data[id].value; duration = m_data[id].duration; loop = m_data[id].loop; }
pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x10, %rsp movq %rdi, (%rsp) movq %r8, %rbx movq %rcx, %r14 movq %rdx, %r15 movq %rsi, %r12 movq %rdi, %r13 movb $0x1, 0x8(%rsp) callq 0x3c460 movq 0x38(%r13), %rax movq 0x50(%r13), %rcx movq %rsp, %rdi movslq (%rax), %rax imulq $0x38, %rax, %rax movl 0x30(%rcx,%rax), %edx movl %edx, (%r12) vmovsd 0x10(%rcx,%rax), %xmm0 vmovsd %xmm0, (%r15) vmovsd 0x18(%rcx,%rax), %xmm0 vmovsd %xmm0, (%r14) movq 0x28(%rcx,%rax), %rax movq %rax, (%rbx) callq 0x3c450 addq $0x10, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 retq movq %rax, %rdi callq 0xeb9f nop
/quesnel[P]baryonyx/lib/src/itm-optimizer-common.hpp
baryonyx::itm::storage<baryonyx::itm::quadratic_cost_type<float>, baryonyx::itm::maximize_tag>::show_population(baryonyx::context const&) const
void show_population(const context& ctx) const { info(ctx, " Population {}:\n", m_indices.size()); for (int i = 0; i != m_size; ++i) info(ctx, " - {}: value {} constraints {} hash {}\n", m_indices[i], m_data[m_indices[i]].value, m_data[m_indices[i]].remaining_constraints, m_data[m_indices[i]].hash); }
pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x10, %rsp movq 0x40(%rdi), %rax movq %rsi, %rbx leaq 0x8(%rsp), %rdx leaq 0x40d2fd(%rip), %rsi # 0x45a53d movq %rdi, %r14 subq 0x38(%rdi), %rax movq %rbx, %rdi sarq $0x2, %rax movq %rax, (%rdx) callq 0x41545 leaq 0x40d2f1(%rip), %r15 # 0x45a54e xorl %r12d, %r12d xorl %r13d, %r13d movl 0x98(%r14), %eax cmpq %rax, %r13 je 0x4d2a5 movq 0x38(%r14), %rdx movq 0x50(%r14), %rax movq %rbx, %rdi movslq (%rdx,%r12), %rcx addq %r12, %rdx imulq $0x38, %rcx, %rsi leaq 0x10(%rax,%rsi), %rcx leaq 0x30(%rax,%rsi), %r8 leaq 0x20(%rax,%rsi), %r9 movq %r15, %rsi callq 0x41567 incq %r13 addq $0x4, %r12 jmp 0x4d263 addq $0x10, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 retq nop
/quesnel[P]baryonyx/lib/src/itm-optimizer-common.hpp
baryonyx::itm::solver_functor<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>>, float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>, baryonyx::pnm_observer>::operator()(std::vector<baryonyx::itm::merged_constraint, std::allocator<baryonyx::itm::merged_constraint>> const&, int, baryonyx::itm::quadratic_cost_type<float> const&, double)
result operator()(const std::vector<merged_constraint>& constraints, int variables, const Cost& original_costs, double cost_constant) { result r; bit_array x(variables); int best_remaining = INT_MAX; auto& p = m_ctx.parameters; auto norm_costs = normalize_costs<Float, Cost>( m_ctx, original_costs, m_rng, variables); const auto kappa_step = static_cast<Float>(p.kappa_step); const auto kappa_max = static_cast<Float>(p.kappa_max); const auto alpha = static_cast<Float>(p.alpha); const auto theta = static_cast<Float>(p.theta); const auto delta = p.delta < 0 ? compute_delta<Float, Cost>(m_ctx, norm_costs, theta, variables) : static_cast<Float>(p.delta); const auto pushing_k_factor = static_cast<Float>(p.pushing_k_factor); const auto pushing_objective_amplifier = static_cast<Float>(p.pushing_objective_amplifier); const long int w_limit = static_cast<long int>(p.w); Solver slv( m_rng, length(constraints), variables, norm_costs, constraints); compute_order compute(p.order, variables); { std::bernoulli_distribution choose_mutation( m_ctx.parameters.init_policy_random); bit_array empty_x; switch (p.init_policy) { case solver_parameters::init_policy_type::pessimistic_solve: init_with_pre_solve<Cost, Mode>( x, empty_x, m_rng, original_costs, constraints, 1.0); break; case solver_parameters::init_policy_type::optimistic_solve: init_with_pre_solve<Cost, Mode>( empty_x, x, m_rng, original_costs, constraints, 1.0); break; case solver_parameters::init_policy_type::bastert: init_with_bastert<Cost, Mode>(x, original_costs, variables, 0); break; } for (int i = 0, e = x.size(); i != e; ++i) if (choose_mutation(m_rng)) x.invert(i); } bool start_push = false; auto kappa = static_cast<Float>(p.kappa_min); Observer obs("img", slv.m, slv.n, p.limit); m_begin = std::chrono::steady_clock::now(); m_end = std::chrono::steady_clock::now(); compute.init(slv, x); for (long int i = 0; i != p.limit; ++i) { auto remaining = compute.run(slv, x, m_rng, kappa, delta, theta); obs.make_observation(slv.ap, slv.P.get(), slv.pi.get()); if (remaining == 0) { store_if_better( x, original_costs.results(x, cost_constant), i); best_remaining = remaining; start_push = true; break; } if (remaining < best_remaining) { store_if_better(x, remaining, i); best_remaining = remaining; } if (i > w_limit) kappa += kappa_step * std::pow(static_cast<Float>(remaining) / static_cast<Float>(slv.m), alpha); if (kappa > kappa_max) { r.status = result_status::kappa_max_reached; break; } if (is_timelimit_reached()) { r.status = result_status::time_limit_reached; break; } } if (!start_push) { r.status = result_status::limit_reached; } else { for (int push = 0; push < p.pushes_limit; ++push) { auto remaining = compute.push_and_run(slv, x, m_rng, pushing_k_factor * kappa, delta, theta, pushing_objective_amplifier); if (remaining == 0) store_if_better(x, original_costs.results(x, cost_constant), -push * p.pushing_iteration_limit - 1); if (is_timelimit_reached()) break; for (int iter = 0; iter < p.pushing_iteration_limit; ++iter) { remaining = compute.run(slv, x, m_rng, kappa, delta, theta); if (remaining == 0) { store_if_better( x, original_costs.results(x, cost_constant), -push * p.pushing_iteration_limit - iter - 1); break; } if (iter > p.w) kappa += kappa_step * std::pow(static_cast<Float>(remaining) / static_cast<Float>(slv.m), alpha); if (kappa > kappa_max) break; if (is_timelimit_reached()) break; } } } if (m_best.remaining_constraints == 0) r.status = result_status::success; if (!m_best.x.empty()) { r.solutions.resize(1); convert(m_best, r.solutions[0], variables); } return r; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x3b8, %rsp # imm = 0x3B8 vmovsd %xmm0, 0x58(%rsp) vxorps %xmm0, %xmm0, %xmm0 movq %r8, %r13 movl %ecx, %ebx movq %rdx, %r15 movq %rsi, %r14 movq %rdi, 0x18(%rsp) vmovups %zmm0, 0x58(%rdi) vmovups %zmm0, 0x40(%rdi) vmovups %zmm0, (%rdi) movq $0x7fffffff, 0x98(%rdi) # imm = 0x7FFFFFFF movl $0x2, 0xa0(%rdi) leaq 0x28(%rsp), %rdi movl %ecx, %esi vzeroupper callq 0x368ae movq 0x10(%r14), %r12 movq 0x18(%r14), %rcx leaq 0x80(%rsp), %rdi movq %r12, %rsi movq %r13, %rdx movl %ebx, %r8d callq 0x46c07 vmovsd 0x20(%r12), %xmm0 vmovsd 0x10(%r12), %xmm2 vxorpd %xmm1, %xmm1, %xmm1 vmovsd %xmm0, 0x48(%rsp) vmovsd 0x28(%r12), %xmm0 vucomisd %xmm2, %xmm1 vmovsd %xmm0, 0x40(%rsp) vmovsd 0x30(%r12), %xmm0 vmovsd %xmm0, 0x38(%rsp) vcvtsd2ss 0x8(%r12), %xmm3, %xmm0 vmovss %xmm0, 0x4(%rsp) jbe 0x4d3c0 movq 0x10(%r14), %rdi leaq 0x80(%rsp), %rsi movl %ebx, %edx callq 0x46ce1 vmovss %xmm0, 0x14(%rsp) jmp 0x4d3ca vcvtsd2ss %xmm2, %xmm2, %xmm0 vmovss %xmm0, 0x14(%rsp) vcvttsd2si 0xa0(%r12), %rax vmovsd 0x38(%r12), %xmm0 vmovsd 0x40(%r12), %xmm1 movq 0x18(%r14), %rsi movq %rax, 0x70(%rsp) movq 0x8(%r15), %rax vmovsd %xmm0, 0x68(%rsp) vmovsd %xmm1, 0x60(%rsp) subq (%r15), %rax pushq $0x28 popq %rcx cqto idivq %rcx leaq 0xd8(%rsp), %rdi leaq 0x80(%rsp), %r8 movl %eax, %edx movl %ebx, %ecx movq %r15, %r9 callq 0x46d5a movl 0xcc(%r12), %esi leaq 0xa0(%rsp), %rdi movl %ebx, %edx callq 0x38cd8 movq 0x10(%r14), %rax movl %ebx, 0x7c(%rsp) vmovsd 0x48(%rax), %xmm0 vmovsd %xmm0, 0x8(%rsp) vxorps %xmm0, %xmm0, %xmm0 vmovaps %xmm0, 0x160(%rsp) movl 0xd4(%r12), %eax testl %eax, %eax je 0x4d4a8 cmpl $0x1, %eax je 0x4d482 cmpl $0x2, %eax jne 0x4d4b9 movq 0x18(%r14), %rdx leaq 0x160(%rsp), %rdi leaq 0x28(%rsp), %rsi jmp 0x4d493 movq 0x18(%r14), %rdx leaq 0x28(%rsp), %rdi leaq 0x160(%rsp), %rsi vmovsd 0x406b9d(%rip), %xmm0 # 0x454038 movq %r13, %rcx movq %r15, %r8 callq 0x44e5a jmp 0x4d4b9 leaq 0x28(%rsp), %rdi movq %r13, %rsi movl %ebx, %edx xorl %ecx, %ecx callq 0x44de5 vcvtsd2ss 0x48(%rsp), %xmm3, %xmm0 leaq 0x28(%rsp), %r15 movq %r13, 0x50(%rsp) xorl %ebx, %ebx movl (%r15), %ebp vmovss %xmm0, 0x24(%rsp) vcvtsd2ss 0x40(%rsp), %xmm3, %xmm0 vmovss %xmm0, 0x48(%rsp) vcvtsd2ss 0x38(%rsp), %xmm3, %xmm0 vmovss %xmm0, 0x40(%rsp) vcvtsd2ss 0x68(%rsp), %xmm3, %xmm0 vmovss %xmm0, 0x68(%rsp) vcvtsd2ss 0x60(%rsp), %xmm3, %xmm0 vmovss %xmm0, 0x60(%rsp) cmpl %ebx, %ebp je 0x4d52b movq 0x18(%r14), %rdi callq 0x36ac3 vmovsd 0x8(%rsp), %xmm1 vucomisd %xmm0, %xmm1 jbe 0x4d527 movq %r15, %rdi movl %ebx, %esi callq 0x3626e incl %ebx jmp 0x4d504 leaq 0x168(%rsp), %rdi callq 0x357fe vmovsd 0x18(%r12), %xmm0 movl 0x158(%rsp), %ecx movl 0x15c(%rsp), %r8d movq 0xb0(%r12), %r9 vmovsd %xmm0, 0x8(%rsp) leaq 0x40d014(%rip), %rdx # 0x45a577 leaq 0x160(%rsp), %rdi pushq $0x3 popq %rsi callq 0x42b5a callq 0xb5a0 movq %rax, (%r14) callq 0xb5a0 movq %rax, 0x8(%r14) leaq 0xa0(%rsp), %rdi leaq 0xd8(%rsp), %rsi leaq 0x28(%rsp), %rdx callq 0x47082 vcvtsd2ss 0x8(%rsp), %xmm3, %xmm0 vmovss 0x4(%rsp), %xmm2 movl $0x7fffffff, %ebp # imm = 0x7FFFFFFF leaq 0x28(%rsp), %r13 xorl %r15d, %r15d cmpq 0xb0(%r12), %r15 je 0x4d69c movq 0x18(%r14), %rcx vmovss 0x14(%rsp), %xmm1 leaq 0xa0(%rsp), %rdi leaq 0xd8(%rsp), %rsi movq %r13, %rdx vmovss %xmm0, 0x8(%rsp) callq 0x470c4 movq 0x140(%rsp), %rdx movq 0x138(%rsp), %rcx movl %eax, %ebx leaq 0x160(%rsp), %rdi leaq 0xe0(%rsp), %rsi callq 0x42bbe testl %ebx, %ebx je 0x4d741 cmpl %ebp, %ebx jge 0x4d632 movq %r14, %rdi movq %r13, %rsi movl %ebx, %edx movq %r15, %rcx callq 0x4e752 movl %ebx, %ebp cmpq 0x70(%rsp), %r15 jle 0x4d668 vcvtsi2ss %ebx, %xmm3, %xmm0 vcvtsi2ssl 0x158(%rsp), %xmm3, %xmm1 vdivss %xmm1, %xmm0, %xmm0 vmovss 0x40(%rsp), %xmm1 callq 0xb530 vmovss 0x8(%rsp), %xmm1 vfmadd231ss 0x24(%rsp), %xmm0, %xmm1 # xmm1 = (xmm0 * mem) + xmm1 vmovaps %xmm1, %xmm0 jmp 0x4d66e vmovss 0x8(%rsp), %xmm0 vucomiss 0x48(%rsp), %xmm0 ja 0x4d69c movq %r14, %rdi vmovss %xmm0, 0x8(%rsp) callq 0x4e78a vmovss 0x8(%rsp), %xmm0 vmovss 0x4(%rsp), %xmm2 testb %al, %al jne 0x4d69c incq %r15 jmp 0x4d5b7 movq 0x18(%rsp), %rax movl $0x5, 0xa0(%rax) cmpl $0x0, 0x50(%r14) jne 0x4d6be movq 0x18(%rsp), %rax andl $0x0, 0xa0(%rax) cmpq $0x0, 0x28(%r14) je 0x4d6ec movq 0x18(%rsp), %rax leaq 0x68(%rax), %rbx pushq $0x1 popq %rsi movq %rbx, %rdi callq 0x35292 movq (%rbx), %rsi addq $0x20, %r14 movl 0x7c(%rsp), %edx movq %r14, %rdi callq 0x35781 leaq 0x160(%rsp), %rdi callq 0x42cbc leaq 0xa0(%rsp), %rdi callq 0x393ac leaq 0xd8(%rsp), %rdi callq 0x475fc leaq 0x80(%rsp), %rdi callq 0x4495c leaq 0x30(%rsp), %rdi callq 0x357fe movq 0x18(%rsp), %rax addq $0x3b8, %rsp # imm = 0x3B8 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq vmovsd 0x58(%rsp), %xmm0 movq 0x50(%rsp), %rdi leaq 0x28(%rsp), %rbx movq %rbx, %rsi callq 0x45118 movq %r14, %rdi movq %rbx, %rsi movq %r15, %rdx callq 0x4e708 vmovss 0x4(%rsp), %xmm2 vmovss 0x8(%rsp), %xmm0 leaq 0xd8(%rsp), %r15 leaq 0x28(%rsp), %rbp xorl %ebx, %ebx movl $0x0, 0x38(%rsp) cmpl 0xbc(%r12), %ebx jge 0x4d6ab vmovss %xmm0, 0x8(%rsp) vmulss 0x68(%rsp), %xmm0, %xmm0 movq 0x18(%r14), %rcx vmovss 0x14(%rsp), %xmm1 vmovss 0x60(%rsp), %xmm3 leaq 0xa0(%rsp), %rdi movq %r15, %rsi movq %rbp, %rdx callq 0x473da testl %eax, %eax jne 0x4d7f9 vmovsd 0x58(%rsp), %xmm0 movq 0x50(%rsp), %rdi movq %rbp, %rsi callq 0x45118 movl 0xc0(%r12), %eax imull %ebx, %eax notl %eax movslq %eax, %rdx movq %r14, %rdi movq %rbp, %rsi callq 0x4e708 movq %r14, %rdi callq 0x4e78a vmovss 0x4(%rsp), %xmm2 vmovss 0x8(%rsp), %xmm0 testb %al, %al jne 0x4d6ab movl %ebx, 0x70(%rsp) pushq $0x1 popq %rax movl %eax, %ebx leal -0x1(%rbx), %r13d cmpl 0xc0(%r12), %r13d jge 0x4d920 movq 0x18(%r14), %rcx vmovss 0x14(%rsp), %xmm1 leaq 0xa0(%rsp), %rdi movq %r15, %rsi movq %rbp, %rdx vmovss %xmm0, 0x8(%rsp) callq 0x470c4 testl %eax, %eax je 0x4d8d6 vcvtsi2sd %r13d, %xmm4, %xmm0 vucomisd 0xa0(%r12), %xmm0 jbe 0x4d89d vcvtsi2ss %eax, %xmm4, %xmm0 vcvtsi2ssl 0x158(%rsp), %xmm4, %xmm1 vdivss %xmm1, %xmm0, %xmm0 vmovss 0x40(%rsp), %xmm1 callq 0xb530 vmovss 0x8(%rsp), %xmm1 vmovss 0x4(%rsp), %xmm2 vfmadd231ss 0x24(%rsp), %xmm0, %xmm1 # xmm1 = (xmm0 * mem) + xmm1 vmovaps %xmm1, %xmm0 jmp 0x4d8a9 vmovss 0x4(%rsp), %xmm2 vmovss 0x8(%rsp), %xmm0 vucomiss 0x48(%rsp), %xmm0 ja 0x4d920 movq %r14, %rdi vmovss %xmm0, 0x8(%rsp) callq 0x4e78a testb %al, %al jne 0x4d914 vmovss 0x4(%rsp), %xmm2 vmovss 0x8(%rsp), %xmm0 incl %ebx jmp 0x4d81e vmovsd 0x58(%rsp), %xmm0 movq 0x50(%rsp), %rdi movq %rbp, %rsi callq 0x45118 movl 0xc0(%r12), %eax imull 0x38(%rsp), %eax subl %ebx, %eax movslq %eax, %rdx movq %r14, %rdi movq %rbp, %rsi callq 0x4e708 vmovss 0x4(%rsp), %xmm2 vmovss 0x8(%rsp), %xmm0 jmp 0x4d920 vmovss 0x4(%rsp), %xmm2 vmovss 0x8(%rsp), %xmm0 movl 0x70(%rsp), %ebx decl 0x38(%rsp) incl %ebx jmp 0x4d78a jmp 0x4d966 jmp 0x4d93f jmp 0x4d966 movq %rax, %r14 jmp 0x4d976 movq %rax, %r14 jmp 0x4d983 movq %rax, %r14 jmp 0x4d990 movq %rax, %r14 jmp 0x4d99d movq %rax, %r14 jmp 0x4d9a7 jmp 0x4d966 jmp 0x4d966 jmp 0x4d966 leaq 0x168(%rsp), %rdi movq %rax, %r14 callq 0x357fe jmp 0x4d976 leaq 0x160(%rsp), %rdi movq %rax, %r14 callq 0x42cbc leaq 0xa0(%rsp), %rdi callq 0x393ac leaq 0xd8(%rsp), %rdi callq 0x475fc leaq 0x80(%rsp), %rdi callq 0x4495c leaq 0x30(%rsp), %rdi callq 0x357fe movq 0x18(%rsp), %rdi callq 0xea60 movq %r14, %rdi callq 0xb3d0 nop
/quesnel[P]baryonyx/lib/src/itm-solver-common.hpp
baryonyx::itm::solver_functor<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>>, float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>, baryonyx::none_observer>::operator()(std::vector<baryonyx::itm::merged_constraint, std::allocator<baryonyx::itm::merged_constraint>> const&, int, baryonyx::itm::quadratic_cost_type<float> const&, double)
result operator()(const std::vector<merged_constraint>& constraints, int variables, const Cost& original_costs, double cost_constant) { result r; bit_array x(variables); int best_remaining = INT_MAX; auto& p = m_ctx.parameters; auto norm_costs = normalize_costs<Float, Cost>( m_ctx, original_costs, m_rng, variables); const auto kappa_step = static_cast<Float>(p.kappa_step); const auto kappa_max = static_cast<Float>(p.kappa_max); const auto alpha = static_cast<Float>(p.alpha); const auto theta = static_cast<Float>(p.theta); const auto delta = p.delta < 0 ? compute_delta<Float, Cost>(m_ctx, norm_costs, theta, variables) : static_cast<Float>(p.delta); const auto pushing_k_factor = static_cast<Float>(p.pushing_k_factor); const auto pushing_objective_amplifier = static_cast<Float>(p.pushing_objective_amplifier); const long int w_limit = static_cast<long int>(p.w); Solver slv( m_rng, length(constraints), variables, norm_costs, constraints); compute_order compute(p.order, variables); { std::bernoulli_distribution choose_mutation( m_ctx.parameters.init_policy_random); bit_array empty_x; switch (p.init_policy) { case solver_parameters::init_policy_type::pessimistic_solve: init_with_pre_solve<Cost, Mode>( x, empty_x, m_rng, original_costs, constraints, 1.0); break; case solver_parameters::init_policy_type::optimistic_solve: init_with_pre_solve<Cost, Mode>( empty_x, x, m_rng, original_costs, constraints, 1.0); break; case solver_parameters::init_policy_type::bastert: init_with_bastert<Cost, Mode>(x, original_costs, variables, 0); break; } for (int i = 0, e = x.size(); i != e; ++i) if (choose_mutation(m_rng)) x.invert(i); } bool start_push = false; auto kappa = static_cast<Float>(p.kappa_min); Observer obs("img", slv.m, slv.n, p.limit); m_begin = std::chrono::steady_clock::now(); m_end = std::chrono::steady_clock::now(); compute.init(slv, x); for (long int i = 0; i != p.limit; ++i) { auto remaining = compute.run(slv, x, m_rng, kappa, delta, theta); obs.make_observation(slv.ap, slv.P.get(), slv.pi.get()); if (remaining == 0) { store_if_better( x, original_costs.results(x, cost_constant), i); best_remaining = remaining; start_push = true; break; } if (remaining < best_remaining) { store_if_better(x, remaining, i); best_remaining = remaining; } if (i > w_limit) kappa += kappa_step * std::pow(static_cast<Float>(remaining) / static_cast<Float>(slv.m), alpha); if (kappa > kappa_max) { r.status = result_status::kappa_max_reached; break; } if (is_timelimit_reached()) { r.status = result_status::time_limit_reached; break; } } if (!start_push) { r.status = result_status::limit_reached; } else { for (int push = 0; push < p.pushes_limit; ++push) { auto remaining = compute.push_and_run(slv, x, m_rng, pushing_k_factor * kappa, delta, theta, pushing_objective_amplifier); if (remaining == 0) store_if_better(x, original_costs.results(x, cost_constant), -push * p.pushing_iteration_limit - 1); if (is_timelimit_reached()) break; for (int iter = 0; iter < p.pushing_iteration_limit; ++iter) { remaining = compute.run(slv, x, m_rng, kappa, delta, theta); if (remaining == 0) { store_if_better( x, original_costs.results(x, cost_constant), -push * p.pushing_iteration_limit - iter - 1); break; } if (iter > p.w) kappa += kappa_step * std::pow(static_cast<Float>(remaining) / static_cast<Float>(slv.m), alpha); if (kappa > kappa_max) break; if (is_timelimit_reached()) break; } } } if (m_best.remaining_constraints == 0) r.status = result_status::success; if (!m_best.x.empty()) { r.solutions.resize(1); convert(m_best, r.solutions[0], variables); } return r; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x178, %rsp # imm = 0x178 vmovsd %xmm0, 0x58(%rsp) vxorps %xmm0, %xmm0, %xmm0 movq %r8, %r13 movl %ecx, %ebx movq %rdx, %r15 movq %rsi, %r14 movq %rdi, 0x18(%rsp) vmovups %zmm0, 0x58(%rdi) vmovups %zmm0, 0x40(%rdi) vmovups %zmm0, (%rdi) movq $0x7fffffff, 0x98(%rdi) # imm = 0x7FFFFFFF movl $0x2, 0xa0(%rdi) leaq 0x28(%rsp), %rdi movl %ecx, %esi vzeroupper callq 0x368ae movq 0x10(%r14), %r12 movq 0x18(%r14), %rcx leaq 0x98(%rsp), %rdi movq %r12, %rsi movq %r13, %rdx movl %ebx, %r8d callq 0x46c07 vmovsd 0x20(%r12), %xmm0 vmovsd 0x10(%r12), %xmm2 vxorpd %xmm1, %xmm1, %xmm1 vmovsd %xmm0, 0x48(%rsp) vmovsd 0x28(%r12), %xmm0 vucomisd %xmm2, %xmm1 vmovsd %xmm0, 0x40(%rsp) vmovsd 0x30(%r12), %xmm0 vmovsd %xmm0, 0x38(%rsp) vcvtsd2ss 0x8(%r12), %xmm3, %xmm0 vmovss %xmm0, 0x4(%rsp) jbe 0x4e17c movq 0x10(%r14), %rdi leaq 0x98(%rsp), %rsi movl %ebx, %edx callq 0x46ce1 vmovss %xmm0, 0x14(%rsp) jmp 0x4e186 vcvtsd2ss %xmm2, %xmm2, %xmm0 vmovss %xmm0, 0x14(%rsp) vcvttsd2si 0xa0(%r12), %rax vmovsd 0x38(%r12), %xmm0 vmovsd 0x40(%r12), %xmm1 movq 0x18(%r14), %rsi movq %rax, 0x70(%rsp) movq 0x8(%r15), %rax vmovsd %xmm0, 0x68(%rsp) vmovsd %xmm1, 0x60(%rsp) subq (%r15), %rax pushq $0x28 popq %rcx cqto idivq %rcx leaq 0xf0(%rsp), %rdi leaq 0x98(%rsp), %r8 movl %eax, %edx movl %ebx, %ecx movq %r15, %r9 callq 0x46d5a movl 0xcc(%r12), %esi leaq 0xb8(%rsp), %rdi movl %ebx, %edx callq 0x38cd8 movq 0x10(%r14), %rax movl %ebx, 0x7c(%rsp) vmovsd 0x48(%rax), %xmm0 vmovsd %xmm0, 0x8(%rsp) vxorps %xmm0, %xmm0, %xmm0 vmovaps %xmm0, 0x80(%rsp) movl 0xd4(%r12), %eax testl %eax, %eax je 0x4e264 cmpl $0x1, %eax je 0x4e23e cmpl $0x2, %eax jne 0x4e275 movq 0x18(%r14), %rdx leaq 0x80(%rsp), %rdi leaq 0x28(%rsp), %rsi jmp 0x4e24f movq 0x18(%r14), %rdx leaq 0x28(%rsp), %rdi leaq 0x80(%rsp), %rsi vmovsd 0x405de1(%rip), %xmm0 # 0x454038 movq %r13, %rcx movq %r15, %r8 callq 0x44e5a jmp 0x4e275 leaq 0x28(%rsp), %rdi movq %r13, %rsi movl %ebx, %edx xorl %ecx, %ecx callq 0x44de5 vcvtsd2ss 0x48(%rsp), %xmm3, %xmm0 leaq 0x28(%rsp), %r15 movq %r13, 0x50(%rsp) xorl %ebx, %ebx movl (%r15), %ebp vmovss %xmm0, 0x24(%rsp) vcvtsd2ss 0x40(%rsp), %xmm3, %xmm0 vmovss %xmm0, 0x48(%rsp) vcvtsd2ss 0x38(%rsp), %xmm3, %xmm0 vmovss %xmm0, 0x40(%rsp) vcvtsd2ss 0x68(%rsp), %xmm3, %xmm0 vmovss %xmm0, 0x68(%rsp) vcvtsd2ss 0x60(%rsp), %xmm3, %xmm0 vmovss %xmm0, 0x60(%rsp) cmpl %ebx, %ebp je 0x4e2e7 movq 0x18(%r14), %rdi callq 0x36ac3 vmovsd 0x8(%rsp), %xmm1 vucomisd %xmm0, %xmm1 jbe 0x4e2e3 movq %r15, %rdi movl %ebx, %esi callq 0x3626e incl %ebx jmp 0x4e2c0 leaq 0x88(%rsp), %rdi callq 0x357fe vmovsd 0x18(%r12), %xmm0 vmovsd %xmm0, 0x8(%rsp) callq 0xb5a0 movq %rax, (%r14) callq 0xb5a0 movq %rax, 0x8(%r14) leaq 0xb8(%rsp), %rdi leaq 0xf0(%rsp), %rsi leaq 0x28(%rsp), %rdx callq 0x47082 vcvtsd2ss 0x8(%rsp), %xmm3, %xmm0 vmovss 0x4(%rsp), %xmm2 movl $0x7fffffff, %ebp # imm = 0x7FFFFFFF leaq 0x28(%rsp), %rbx xorl %r15d, %r15d cmpq 0xb0(%r12), %r15 je 0x4e40a movq 0x18(%r14), %rcx vmovss 0x14(%rsp), %xmm1 leaq 0xb8(%rsp), %rdi leaq 0xf0(%rsp), %rsi movq %rbx, %rdx vmovss %xmm0, 0x8(%rsp) callq 0x470c4 movl %eax, %r13d testl %eax, %eax je 0x4e4a2 cmpl %ebp, %r13d jge 0x4e39f movq %r14, %rdi movq %rbx, %rsi movl %r13d, %edx movq %r15, %rcx callq 0x4e916 movl %r13d, %ebp cmpq 0x70(%rsp), %r15 jle 0x4e3d6 vcvtsi2ss %r13d, %xmm3, %xmm0 vcvtsi2ssl 0x170(%rsp), %xmm3, %xmm1 vdivss %xmm1, %xmm0, %xmm0 vmovss 0x40(%rsp), %xmm1 callq 0xb530 vmovss 0x8(%rsp), %xmm1 vfmadd231ss 0x24(%rsp), %xmm0, %xmm1 # xmm1 = (xmm0 * mem) + xmm1 vmovaps %xmm1, %xmm0 jmp 0x4e3dc vmovss 0x8(%rsp), %xmm0 vucomiss 0x48(%rsp), %xmm0 ja 0x4e40a movq %r14, %rdi vmovss %xmm0, 0x8(%rsp) callq 0x4e94e vmovss 0x8(%rsp), %xmm0 vmovss 0x4(%rsp), %xmm2 testb %al, %al jne 0x4e40a incq %r15 jmp 0x4e345 movq 0x18(%rsp), %rax movl $0x5, 0xa0(%rax) cmpl $0x0, 0x50(%r14) jne 0x4e42c movq 0x18(%rsp), %rax andl $0x0, 0xa0(%rax) cmpq $0x0, 0x28(%r14) je 0x4e45a movq 0x18(%rsp), %rax leaq 0x68(%rax), %rbx pushq $0x1 popq %rsi movq %rbx, %rdi callq 0x35292 movq (%rbx), %rsi addq $0x20, %r14 movl 0x7c(%rsp), %edx movq %r14, %rdi callq 0x35781 leaq 0xb8(%rsp), %rdi callq 0x393ac leaq 0xf0(%rsp), %rdi callq 0x475fc leaq 0x98(%rsp), %rdi callq 0x4495c leaq 0x30(%rsp), %rdi callq 0x357fe movq 0x18(%rsp), %rax addq $0x178, %rsp # imm = 0x178 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq vmovsd 0x58(%rsp), %xmm0 movq 0x50(%rsp), %rdi leaq 0x28(%rsp), %rbx movq %rbx, %rsi callq 0x45118 movq %r14, %rdi movq %rbx, %rsi movq %r15, %rdx callq 0x4e8cc vmovss 0x4(%rsp), %xmm2 vmovss 0x8(%rsp), %xmm0 leaq 0xf0(%rsp), %r15 leaq 0x28(%rsp), %rbp xorl %ebx, %ebx movl $0x0, 0x38(%rsp) cmpl 0xbc(%r12), %ebx jge 0x4e419 vmovss %xmm0, 0x8(%rsp) vmulss 0x68(%rsp), %xmm0, %xmm0 movq 0x18(%r14), %rcx vmovss 0x14(%rsp), %xmm1 vmovss 0x60(%rsp), %xmm3 leaq 0xb8(%rsp), %rdi movq %r15, %rsi movq %rbp, %rdx callq 0x473da testl %eax, %eax jne 0x4e55a vmovsd 0x58(%rsp), %xmm0 movq 0x50(%rsp), %rdi movq %rbp, %rsi callq 0x45118 movl 0xc0(%r12), %eax imull %ebx, %eax notl %eax movslq %eax, %rdx movq %r14, %rdi movq %rbp, %rsi callq 0x4e8cc movq %r14, %rdi callq 0x4e94e vmovss 0x4(%rsp), %xmm2 vmovss 0x8(%rsp), %xmm0 testb %al, %al jne 0x4e419 movl %ebx, 0x70(%rsp) pushq $0x1 popq %rax movl %eax, %ebx leal -0x1(%rbx), %r13d cmpl 0xc0(%r12), %r13d jge 0x4e681 movq 0x18(%r14), %rcx vmovss 0x14(%rsp), %xmm1 leaq 0xb8(%rsp), %rdi movq %r15, %rsi movq %rbp, %rdx vmovss %xmm0, 0x8(%rsp) callq 0x470c4 testl %eax, %eax je 0x4e637 vcvtsi2sd %r13d, %xmm4, %xmm0 vucomisd 0xa0(%r12), %xmm0 jbe 0x4e5fe vcvtsi2ss %eax, %xmm4, %xmm0 vcvtsi2ssl 0x170(%rsp), %xmm4, %xmm1 vdivss %xmm1, %xmm0, %xmm0 vmovss 0x40(%rsp), %xmm1 callq 0xb530 vmovss 0x8(%rsp), %xmm1 vmovss 0x4(%rsp), %xmm2 vfmadd231ss 0x24(%rsp), %xmm0, %xmm1 # xmm1 = (xmm0 * mem) + xmm1 vmovaps %xmm1, %xmm0 jmp 0x4e60a vmovss 0x4(%rsp), %xmm2 vmovss 0x8(%rsp), %xmm0 vucomiss 0x48(%rsp), %xmm0 ja 0x4e681 movq %r14, %rdi vmovss %xmm0, 0x8(%rsp) callq 0x4e94e testb %al, %al jne 0x4e675 vmovss 0x4(%rsp), %xmm2 vmovss 0x8(%rsp), %xmm0 incl %ebx jmp 0x4e57f vmovsd 0x58(%rsp), %xmm0 movq 0x50(%rsp), %rdi movq %rbp, %rsi callq 0x45118 movl 0xc0(%r12), %eax imull 0x38(%rsp), %eax subl %ebx, %eax movslq %eax, %rdx movq %r14, %rdi movq %rbp, %rsi callq 0x4e8cc vmovss 0x4(%rsp), %xmm2 vmovss 0x8(%rsp), %xmm0 jmp 0x4e681 vmovss 0x4(%rsp), %xmm2 vmovss 0x8(%rsp), %xmm0 movl 0x70(%rsp), %ebx decl 0x38(%rsp) incl %ebx jmp 0x4e4eb jmp 0x4e6c2 jmp 0x4e69b jmp 0x4e6c2 movq %rax, %r14 jmp 0x4e6d2 movq %rax, %r14 jmp 0x4e6df movq %rax, %r14 jmp 0x4e6ec movq %rax, %r14 jmp 0x4e6f6 jmp 0x4e6c2 jmp 0x4e6c2 jmp 0x4e6c2 leaq 0x88(%rsp), %rdi movq %rax, %r14 callq 0x357fe jmp 0x4e6c5 movq %rax, %r14 leaq 0xb8(%rsp), %rdi callq 0x393ac leaq 0xf0(%rsp), %rdi callq 0x475fc leaq 0x98(%rsp), %rdi callq 0x4495c leaq 0x30(%rsp), %rdi callq 0x357fe movq 0x18(%rsp), %rdi callq 0xea60 movq %r14, %rdi callq 0xb3d0
/quesnel[P]baryonyx/lib/src/itm-solver-common.hpp
baryonyx::itm::solver_functor<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>>, float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>, baryonyx::pnm_observer>::store_if_better(baryonyx::bit_array const&, double, long)
inline bool is_better_solution(Float lhs, Float rhs) noexcept { if constexpr (std::is_same_v<Mode, minimize_tag>) return lhs < rhs; else return lhs > rhs; }
vucomisd 0x30(%rdi), %xmm0 jbe 0x4e750 pushq %r14 pushq %rbx pushq %rax movq %rdi, %r14 addq $0x20, %rdi movq %rdx, %rbx vmovsd %xmm0, (%rsp) callq 0x36a44 movq %r14, %rdi callq 0x4e7ca vmovsd (%rsp), %xmm1 vmovsd %xmm0, 0x38(%r14) movq %rbx, 0x48(%r14) andl $0x0, 0x50(%r14) vmovsd %xmm1, 0x30(%r14) addq $0x8, %rsp popq %rbx popq %r14 retq nop
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::itm::solver_functor<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>>, float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>, baryonyx::pnm_observer>::is_timelimit_reached()
bool is_timelimit_reached() { m_end = std::chrono::steady_clock::now(); return is_time_limit(m_ctx.parameters.time_limit, m_begin, m_end); }
pushq %rbx movq %rdi, %rbx callq 0xb5a0 movq %rax, 0x8(%rbx) vxorpd %xmm2, %xmm2, %xmm2 movq 0x10(%rbx), %rcx subq (%rbx), %rax vmovsd (%rcx), %xmm0 vcvtsi2sd %rax, %xmm1, %xmm1 vdivsd 0x40b2cd(%rip), %xmm1, %xmm1 # 0x459a80 vcmpnlepd %xmm2, %xmm0, %k1 vcmpltpd %xmm1, %xmm0, %k0 {%k1} kmovd %k0, %eax andb $0x1, %al popq %rbx retq nop
/quesnel[P]baryonyx/lib/src/itm-solver-common.hpp
baryonyx::itm::solver_functor<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>>, float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>, baryonyx::file_observer>::store_if_better(baryonyx::bit_array const&, double, long)
inline bool is_better_solution(Float lhs, Float rhs) noexcept { if constexpr (std::is_same_v<Mode, minimize_tag>) return lhs < rhs; else return lhs > rhs; }
vucomisd 0x30(%rdi), %xmm0 jbe 0x4e832 pushq %r14 pushq %rbx pushq %rax movq %rdi, %r14 addq $0x20, %rdi movq %rdx, %rbx vmovsd %xmm0, (%rsp) callq 0x36a44 movq %r14, %rdi callq 0x4e8ac vmovsd (%rsp), %xmm1 vmovsd %xmm0, 0x38(%r14) movq %rbx, 0x48(%r14) andl $0x0, 0x50(%r14) vmovsd %xmm1, 0x30(%r14) addq $0x8, %rsp popq %rbx popq %r14 retq nop
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::itm::solver_functor<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>>, float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>, baryonyx::file_observer>::is_timelimit_reached()
bool is_timelimit_reached() { m_end = std::chrono::steady_clock::now(); return is_time_limit(m_ctx.parameters.time_limit, m_begin, m_end); }
pushq %rbx movq %rdi, %rbx callq 0xb5a0 movq %rax, 0x8(%rbx) vxorpd %xmm2, %xmm2, %xmm2 movq 0x10(%rbx), %rcx subq (%rbx), %rax vmovsd (%rcx), %xmm0 vcvtsi2sd %rax, %xmm1, %xmm1 vdivsd 0x40b1eb(%rip), %xmm1, %xmm1 # 0x459a80 vcmpnlepd %xmm2, %xmm0, %k1 vcmpltpd %xmm1, %xmm0, %k0 {%k1} kmovd %k0, %eax andb $0x1, %al popq %rbx retq nop
/quesnel[P]baryonyx/lib/src/itm-solver-common.hpp
baryonyx::itm::solver_functor<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>>, float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>, baryonyx::none_observer>::store_if_better(baryonyx::bit_array const&, double, long)
inline bool is_better_solution(Float lhs, Float rhs) noexcept { if constexpr (std::is_same_v<Mode, minimize_tag>) return lhs < rhs; else return lhs > rhs; }
vucomisd 0x30(%rdi), %xmm0 jbe 0x4e914 pushq %r14 pushq %rbx pushq %rax movq %rdi, %r14 addq $0x20, %rdi movq %rdx, %rbx vmovsd %xmm0, (%rsp) callq 0x36a44 movq %r14, %rdi callq 0x4e98e vmovsd (%rsp), %xmm1 vmovsd %xmm0, 0x38(%r14) movq %rbx, 0x48(%r14) andl $0x0, 0x50(%r14) vmovsd %xmm1, 0x30(%r14) addq $0x8, %rsp popq %rbx popq %r14 retq nop
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::itm::solver_functor<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>>, float, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<float>, baryonyx::none_observer>::is_timelimit_reached()
bool is_timelimit_reached() { m_end = std::chrono::steady_clock::now(); return is_time_limit(m_ctx.parameters.time_limit, m_begin, m_end); }
pushq %rbx movq %rdi, %rbx callq 0xb5a0 movq %rax, 0x8(%rbx) vxorpd %xmm2, %xmm2, %xmm2 movq 0x10(%rbx), %rcx subq (%rbx), %rax vmovsd (%rcx), %xmm0 vcvtsi2sd %rax, %xmm1, %xmm1 vdivsd 0x40b109(%rip), %xmm1, %xmm1 # 0x459a80 vcmpnlepd %xmm2, %xmm0, %k1 vcmpltpd %xmm1, %xmm0, %k0 {%k1} kmovd %k0, %eax andb $0x1, %al popq %rbx retq nop
/quesnel[P]baryonyx/lib/src/itm-solver-common.hpp
baryonyx::result baryonyx::itm::optimize_problem<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::minimize_tag, baryonyx::itm::default_cost_type<float>>, float, baryonyx::itm::minimize_tag, baryonyx::itm::default_cost_type<float>>(baryonyx::context const&, baryonyx::problem const&)
inline result optimize_problem(const context& ctx, const problem& pb) { result r; if (ctx.start) ctx.start(ctx.parameters); auto constraints{ make_merged_constraints(ctx, pb) }; if (constraints.empty() || pb.vars.values.empty()) { r.status = result_status::success; r.solutions.resize(1); r.solutions.back().value = pb.objective.value; r.strings = pb.strings; r.affected_vars = pb.affected_vars; r.variable_name = pb.vars.names; return r; } random_engine rng(init_random_generator_seed(ctx)); auto variables = length(pb.vars.values); auto cost = Cost(pb.objective, variables); auto cost_constant = pb.objective.value; const auto thread = get_thread_number(ctx); std::vector<optimize_functor<Solver, Float, Mode, Cost>> functors; std::vector<std::thread> pool(thread); best_solution_recorder<Cost, Float, Mode> best_recorder( rng, thread, cost, cost_constant, variables, constraints, ctx.parameters.init_population_size); auto seeds = generate_seed(rng, thread); std::atomic_bool stop_task; stop_task.store(false); for (unsigned i = 0u; i != thread; ++i) functors.emplace_back(ctx, i, seeds[i]); for (unsigned i = 0u; i != thread; ++i) pool[i] = std::thread(std::ref(functors[i]), std::ref(stop_task), std::ref(best_recorder), std::cref(constraints), variables, std::cref(cost), cost_constant); const auto start = std::chrono::steady_clock::now(); auto end = start; do { std::this_thread::sleep_for(std::chrono::seconds{ 1L }); if (ctx.update) { auto call_number = 0L; for (auto i = 0u; i != thread; ++i) call_number += functors[i].m_call_number; int constraints_remaining; long int loop; double value; double duration; best_recorder.get_best( constraints_remaining, value, duration, loop); ctx.update( constraints_remaining, value, loop, duration, call_number); } end = std::chrono::steady_clock::now(); } while (!is_time_limit(ctx.parameters.time_limit, start, end)); stop_task.store(true); for (auto& t : pool) t.join(); r.strings = pb.strings; r.affected_vars = pb.affected_vars; r.variable_name = pb.vars.names; r.variables = variables; r.constraints = length(constraints); const auto& first = best_recorder.get_best(0); if (!first.is_solution()) r.status = result_status::time_limit_reached; else r.status = result_status::success; r.duration = first.duration; r.loop = first.loop; r.remaining_constraints = first.remaining_constraints; switch (ctx.parameters.storage) { case solver_parameters::storage_type::one: { r.solutions.resize(1); convert(first, r.solutions[0], variables); } break; case solver_parameters::storage_type::bound: { r.solutions.resize(2); convert(first, r.solutions[0], variables); convert(best_recorder.get_worst(), r.solutions[1], variables); } break; case solver_parameters::storage_type::five: { r.solutions.resize(5); for (int i = 0; i != 5; ++i) convert(best_recorder.get_best(i), r.solutions[i], variables); } break; } best_recorder.show_population(ctx); if (ctx.finish) ctx.finish(r); return r; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x188, %rsp # imm = 0x188 vxorpd %xmm0, %xmm0, %xmm0 movq %rdx, %r13 movq %rsi, %r15 movq %rdi, %r12 vmovupd %zmm0, 0x58(%rdi) vmovupd %zmm0, 0x40(%rdi) vmovupd %zmm0, (%rdi) movq $0x7fffffff, 0x98(%rdi) # imm = 0x7FFFFFFF movl $0x2, 0xa0(%rdi) cmpq $0x0, 0x128(%rsi) je 0x4ea13 leaq 0x118(%r15), %rdi movq %r15, %rsi vzeroupper callq 0x3527e leaq 0x48(%rsp), %rdi movq %r15, %rsi movq %r13, %rdx vzeroupper callq 0x450078 movq 0x48(%rsp), %rax cmpq 0x50(%rsp), %rax je 0x4eb6f movq 0xa8(%r13), %rax cmpq 0xb0(%r13), %rax je 0x4eb6f movq %r15, %rdi callq 0x353ba movl $0x7fffffff, %ecx # imm = 0x7FFFFFFF xorl %edx, %edx divq %rcx cmpq $0x1, %rdx adcq $0x0, %rdx movq %rdx, 0x40(%rsp) movq 0xb0(%r13), %rax subq 0xa8(%r13), %rax pushq $0xc popq %rcx cqto leaq 0x10(%r13), %rsi idivq %rcx movl %eax, 0x4(%rsp) leaq 0x60(%rsp), %rdi movl %eax, %edx movq %r12, 0x10(%rsp) callq 0x353d2 vmovsd 0x40(%r13), %xmm0 vmovsd %xmm0, 0x38(%rsp) movq %r15, %rdi callq 0x35447 andq $0x0, 0x80(%rsp) vxorpd %xmm0, %xmm0, %xmm0 movl %eax, %ebp vmovapd %xmm0, 0x70(%rsp) leaq 0xb0(%rsp), %rdi leaq 0xc8(%rsp), %rdx movq %rbp, %rsi callq 0x35462 vmovsd 0x38(%rsp), %xmm0 movl 0xc4(%r15), %eax movl 0x4(%rsp), %r8d subq $0x8, %rsp movl %ebp, %edx leaq 0xd0(%rsp), %rdi leaq 0x48(%rsp), %rsi leaq 0x68(%rsp), %rcx leaq 0x50(%rsp), %r9 pushq %rax callq 0x4f322 popq %rax popq %rcx leaq 0x30(%rsp), %rdi leaq 0x40(%rsp), %rsi movl %ebp, %edx callq 0x3551c xorl %eax, %eax movb %al, 0x3(%rsp) xorl %ecx, %ecx leaq 0x70(%rsp), %rbx leaq 0x8(%rsp), %r14 xchgb %cl, 0x3(%rsp) leaq 0x90(%r13), %rcx movq %rcx, 0x98(%rsp) movl %eax, 0x8(%rsp) cmpl %ebp, %eax je 0x4ebca movl %eax, %ecx shlq $0x3, %rcx addq 0x30(%rsp), %rcx movq %rbx, %rdi movq %r15, %rsi movq %r14, %rdx callq 0x4f388 movl 0x8(%rsp), %eax incl %eax jmp 0x4eb46 andl $0x0, 0xa0(%r12) leaq 0x68(%r12), %rdi pushq $0x1 popq %rsi callq 0x35292 vmovsd 0x40(%r13), %xmm0 movq 0x70(%r12), %rax vmovsd %xmm0, -0x8(%rax) movq %r12, %rdi movq %r13, %rsi callq 0x31d28 leaq 0xc0(%r13), %rsi leaq 0x20(%r12), %rdi callq 0x352c2 addq $0x90, %r13 leaq 0x50(%r12), %rdi movq %r13, %rsi callq 0x352ec jmp 0x4ef5f movq %r13, 0x90(%rsp) movq %r15, %r13 leaq 0x8(%rsp), %r15 leaq 0xa8(%rsp), %r14 leaq 0x4(%rsp), %rbx xorl %r12d, %r12d cmpq %rbp, %r12 je 0x4ec8b imulq $0xc0, %r12, %rax addq 0x70(%rsp), %rax leaq 0x3(%rsp), %r10 leaq 0xc8(%rsp), %r11 movq %r10, 0x20(%rsp) leaq 0x48(%rsp), %r10 movq %r11, 0x18(%rsp) movq %r10, 0xa8(%rsp) movq %rax, 0x28(%rsp) leaq 0x60(%rsp), %rax movq %rax, 0xa0(%rsp) leaq 0x20(%rsp), %rdx leaq 0x38(%rsp), %rax movq %r15, %rdi leaq 0x28(%rsp), %rsi leaq 0x18(%rsp), %rcx movq %r14, %r8 movq %rbx, %r9 pushq %rax leaq 0xa8(%rsp), %rax pushq %rax callq 0x4f3d4 popq %rax popq %rcx leaq (,%r12,8), %rdi addq 0xb0(%rsp), %rdi movq %r15, %rsi callq 0x356d6 movq %r15, %rdi callq 0x356f0 incq %r12 jmp 0x4ebea callq 0xb5a0 imulq $0xc0, %rbp, %r15 leaq 0x138(%r13), %r12 leaq 0x8(%rsp), %rbp movq %rax, %rbx movq $0x1, 0x8(%rsp) movq %rbp, %rdi callq 0x356fd cmpq $0x0, 0x148(%r13) je 0x4ed20 movq 0x70(%rsp), %rax xorl %ecx, %ecx xorl %r14d, %r14d cmpq %rcx, %r15 je 0x4ece1 addq 0xb0(%rax,%rcx), %r14 addq $0xc0, %rcx jmp 0x4eccb leaq 0xd0(%rsp), %rdi leaq 0x18(%rsp), %rsi leaq 0x28(%rsp), %rdx leaq 0x20(%rsp), %rcx movq %rbp, %r8 callq 0x56bc2 vmovsd 0x28(%rsp), %xmm0 vmovsd 0x20(%rsp), %xmm1 movq 0x8(%rsp), %rdx movl 0x18(%rsp), %esi movq %r12, %rdi movq %r14, %rcx callq 0x35736 callq 0xb5a0 vmovsd (%r13), %xmm0 subq %rbx, %rax vxorpd %xmm1, %xmm1, %xmm1 vucomisd %xmm0, %xmm1 vcvtsi2sd %rax, %xmm2, %xmm1 vdivsd 0x40ad3d(%rip), %xmm1, %xmm1 # 0x459a80 jae 0x4eca6 vucomisd %xmm0, %xmm1 jbe 0x4eca6 movb $0x1, %al xchgb %al, 0x3(%rsp) movq 0xb0(%rsp), %rbx movq 0xb8(%rsp), %r14 movq 0x10(%rsp), %r12 cmpq %r14, %rbx je 0x4ed81 movq %rbx, %rdi callq 0xb1a0 addq $0x8, %rbx jmp 0x4ed6e movq 0x90(%rsp), %rbx movq %r12, %rdi movq %rbx, %rsi callq 0x31d28 addq $0xc0, %rbx leaq 0x20(%r12), %rdi movq %rbx, %rsi callq 0x352c2 leaq 0x50(%r12), %rdi movq 0x98(%rsp), %rsi callq 0x352ec movl 0x4(%rsp), %eax movl %eax, 0x90(%r12) movq 0x50(%rsp), %rax subq 0x48(%rsp), %rax pushq $0x28 popq %rcx cqto xorl %esi, %esi idivq %rcx movq 0x108(%rsp), %rdi movq 0x120(%rsp), %rcx movl %eax, 0x94(%r12) movslq (%rdi), %rax imulq $0x38, %rax, %rax movl 0x30(%rcx,%rax), %edx leaq (%rcx,%rax), %rbx testl %edx, %edx setne %sil leal (%rsi,%rsi,2), %esi movl %esi, 0xa0(%r12) vmovsd 0x18(%rcx,%rax), %xmm0 vmovsd %xmm0, 0x80(%r12) movq 0x28(%rcx,%rax), %rax movq %rax, 0x88(%r12) movl %edx, 0x98(%r12) movl 0xe8(%r13), %eax testl %eax, %eax je 0x4eedc cmpl $0x1, %eax je 0x4eea4 cmpl $0x2, %eax jne 0x4eefb leaq 0x68(%r12), %rbx pushq $0x5 popq %rsi movq %rbx, %rdi callq 0x35292 xorl %r14d, %r14d xorl %r15d, %r15d cmpq $0x5, %r15 je 0x4eefb movq 0x108(%rsp), %rax movq (%rbx), %rsi movl 0x4(%rsp), %edx movslq (%rax,%r15,4), %rax addq %r14, %rsi imulq $0x38, %rax, %rdi addq 0x120(%rsp), %rdi callq 0x4f485 incq %r15 addq $0x20, %r14 jmp 0x4ee6a leaq 0x68(%r12), %r14 pushq $0x2 popq %rsi movq %r14, %rdi callq 0x35292 movl 0x4(%rsp), %edx movq (%r14), %rsi movq %rbx, %rdi callq 0x4f485 leaq 0xd0(%rsp), %rdi callq 0x56c40 movq (%r14), %rsi movq %rax, %rbx addq $0x20, %rsi jmp 0x4eeef leaq 0x68(%r12), %r14 pushq $0x1 popq %rsi movq %r14, %rdi callq 0x35292 movq (%r14), %rsi movl 0x4(%rsp), %edx movq %rbx, %rdi callq 0x4f485 leaq 0xc8(%rsp), %rdi movq %r13, %rsi callq 0x4f4da cmpq $0x0, 0x168(%r13) je 0x4ef27 addq $0x158, %r13 # imm = 0x158 movq %r13, %rdi movq %r12, %rsi callq 0x357ea leaq 0x30(%rsp), %rdi callq 0x357fe leaq 0xc8(%rsp), %rdi callq 0x4f4ee leaq 0xb0(%rsp), %rdi callq 0x35836 leaq 0x70(%rsp), %rdi callq 0x56d20 leaq 0x68(%rsp), %rdi callq 0x35c1a leaq 0x48(%rsp), %rdi callq 0x35858 movq %r12, %rax addq $0x188, %rsp # imm = 0x188 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq movq %rax, %rbx jmp 0x4efc0 movq %rax, %rbx jmp 0x4efcd movq %rax, %rbx jmp 0x4efda jmp 0x4efa4 jmp 0x4ef95 jmp 0x4efb3 jmp 0x4efb3 movq %r12, 0x10(%rsp) movq %rax, %rbx jmp 0x4eff8 movq %r12, 0x10(%rsp) movq %rax, %rbx jmp 0x4efee jmp 0x4efb3 jmp 0x4efb3 jmp 0x4efb3 jmp 0x4efb3 jmp 0x4efb3 movq %rax, %rbx leaq 0x30(%rsp), %rdi callq 0x357fe leaq 0xc8(%rsp), %rdi callq 0x4f4ee leaq 0xb0(%rsp), %rdi callq 0x35836 leaq 0x70(%rsp), %rdi callq 0x56d20 leaq 0x68(%rsp), %rdi callq 0x35c1a leaq 0x48(%rsp), %rdi callq 0x35858 movq 0x10(%rsp), %rdi callq 0xea60 movq %rbx, %rdi callq 0xb3d0
/quesnel[P]baryonyx/lib/src/itm-optimizer-common.hpp
baryonyx::result baryonyx::itm::solve_problem<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::minimize_tag, baryonyx::itm::default_cost_type<float>>, float, baryonyx::itm::minimize_tag, baryonyx::itm::default_cost_type<float>>(baryonyx::context const&, baryonyx::problem const&)
inline result solve_problem(const context& ctx, const problem& pb) { if (ctx.start) ctx.start(ctx.parameters); result ret; auto variables = length(pb.vars.values); auto constraints{ make_merged_constraints(ctx, pb) }; if (!constraints.empty() && !pb.vars.values.empty()) { random_engine rng(init_random_generator_seed(ctx)); auto cost = Cost(pb.objective, variables); auto cost_constant = pb.objective.value; switch (ctx.parameters.observer) { case solver_parameters::observer_type::pnm: { using obs = pnm_observer; solver_functor<Solver, Float, Mode, Cost, obs> slv(ctx, rng); ret = slv(constraints, variables, cost, cost_constant); } break; case solver_parameters::observer_type::file: { using obs = file_observer; solver_functor<Solver, Float, Mode, Cost, obs> slv(ctx, rng); ret = slv(constraints, variables, cost, cost_constant); } break; default: { using obs = none_observer; solver_functor<Solver, Float, Mode, Cost, obs> slv(ctx, rng); ret = slv(constraints, variables, cost, cost_constant); break; } } } else { ret.status = result_status::success; ret.solutions.resize(1); ret.solutions.back().value = pb.objective.value; } ret.strings = pb.strings; ret.variable_name = std::move(pb.vars.names); ret.affected_vars = std::move(pb.affected_vars); ret.variables = variables; ret.constraints = length(constraints); if (ctx.finish) ctx.finish(ret); return ret; }
pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x130, %rsp # imm = 0x130 cmpq $0x0, 0x128(%rsi) movq %rdx, %r15 movq %rsi, %r14 movq %rdi, %rbx je 0x4f03c leaq 0x118(%r14), %rdi movq %r14, %rsi callq 0x3527e vxorps %xmm0, %xmm0, %xmm0 vmovups %zmm0, 0x58(%rbx) vmovups %zmm0, 0x40(%rbx) vmovups %zmm0, (%rbx) movq $0x7fffffff, 0x98(%rbx) # imm = 0x7FFFFFFF movl $0x2, 0xa0(%rbx) movq 0xb0(%r15), %rax subq 0xa8(%r15), %rax pushq $0xc popq %rcx cqto idivq %rcx movq %rax, %r12 leaq 0x8(%rsp), %rdi movq %r14, %rsi movq %r15, %rdx vzeroupper callq 0x450078 movq 0x8(%rsp), %rax cmpq 0x10(%rsp), %rax je 0x4f165 movq 0xa8(%r15), %rax cmpq 0xb0(%r15), %rax je 0x4f165 movq %r14, %rdi callq 0x353ba movl $0x7fffffff, %ecx # imm = 0x7FFFFFFF xorl %edx, %edx leaq 0x10(%r15), %rsi divq %rcx cmpq $0x1, %rdx adcq $0x0, %rdx movq %rdx, (%rsp) leaq 0x20(%rsp), %rdi movl %r12d, %edx callq 0x353d2 vmovsd 0x40(%r15), %xmm0 movl 0xe4(%r14), %eax vxorps %xmm1, %xmm1, %xmm1 leaq 0x30(%rsp), %rsi cmpl $0x1, %eax je 0x4f18c cmpl $0x2, %eax jne 0x4f1db movabsq $0x7ff0000000000000, %r9 # imm = 0x7FF0000000000000 vmovaps %xmm1, (%rsi) movq %r14, 0x10(%rsi) movq %rsp, %rax movq %rax, 0x18(%rsi) vmovaps %xmm1, 0x20(%rsi) movq %r9, 0x30(%rsi) andq $0x0, 0x48(%rsi) vmovups %xmm1, 0x38(%rsi) movl $0x7fffffff, 0x50(%rsi) # imm = 0x7FFFFFFF leaq 0x88(%rsp), %rdi leaq 0x8(%rsp), %rdx leaq 0x20(%rsp), %r8 movl %r12d, %ecx callq 0x57426 jmp 0x4f228 andl $0x0, 0xa0(%rbx) leaq 0x68(%rbx), %rdi pushq $0x1 popq %rsi callq 0x35292 vmovsd 0x40(%r15), %xmm0 movq 0x70(%rbx), %rax vmovsd %xmm0, -0x8(%rax) jmp 0x4f257 movabsq $0x7ff0000000000000, %r9 # imm = 0x7FF0000000000000 vmovaps %xmm1, (%rsi) movq %r14, 0x10(%rsi) movq %rsp, %rax movq %rax, 0x18(%rsi) vmovaps %xmm1, 0x20(%rsi) movq %r9, 0x30(%rsi) andq $0x0, 0x48(%rsi) vmovups %xmm1, 0x38(%rsi) movl $0x7fffffff, 0x50(%rsi) # imm = 0x7FFFFFFF leaq 0x88(%rsp), %rdi leaq 0x8(%rsp), %rdx leaq 0x20(%rsp), %r8 movl %r12d, %ecx callq 0x56d48 jmp 0x4f228 movabsq $0x7ff0000000000000, %r9 # imm = 0x7FF0000000000000 vmovaps %xmm1, (%rsi) movq %r14, 0x10(%rsi) movq %rsp, %rax movq %rax, 0x18(%rsi) vmovaps %xmm1, 0x20(%rsi) movq %r9, 0x30(%rsi) andq $0x0, 0x48(%rsi) vmovups %xmm1, 0x38(%rsi) movl $0x7fffffff, 0x50(%rsi) # imm = 0x7FFFFFFF leaq 0x88(%rsp), %rdi leaq 0x8(%rsp), %rdx leaq 0x20(%rsp), %r8 movl %r12d, %ecx callq 0x57b04 leaq 0x88(%rsp), %r13 movq %rbx, %rdi movq %r13, %rsi callq 0x41d9e movq %r13, %rdi callq 0xea60 leaq 0x58(%rsp), %rdi callq 0x357fe leaq 0x28(%rsp), %rdi callq 0x35c1a leaq 0x90(%r15), %r13 movq %rbx, %rdi movq %r15, %rsi callq 0x31d28 leaq 0x50(%rbx), %rdi movq %r13, %rsi callq 0x352ec addq $0xc0, %r15 leaq 0x20(%rbx), %rdi movq %r15, %rsi callq 0x352c2 movq 0x10(%rsp), %rax movl %r12d, 0x90(%rbx) subq 0x8(%rsp), %rax pushq $0x28 popq %rcx cqto idivq %rcx movl %eax, 0x94(%rbx) cmpq $0x0, 0x168(%r14) je 0x4f2c3 addq $0x158, %r14 # imm = 0x158 movq %r14, %rdi movq %rbx, %rsi callq 0x357ea leaq 0x8(%rsp), %rdi callq 0x35858 movq %rbx, %rax addq $0x130, %rsp # imm = 0x130 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 retq jmp 0x4f2e5 jmp 0x4f2e5 leaq 0x58(%rsp), %rdi movq %rax, %r14 callq 0x357fe leaq 0x28(%rsp), %rdi callq 0x35c1a jmp 0x4f308 jmp 0x4f305 movq %rax, %r14 jmp 0x4f312 movq %rax, %r14 leaq 0x8(%rsp), %rdi callq 0x35858 movq %rbx, %rdi callq 0xea60 movq %r14, %rdi callq 0xb3d0
/quesnel[P]baryonyx/lib/src/itm-solver-common.hpp
void baryonyx::convert<baryonyx::itm::minimize_tag>(baryonyx::raw_result<baryonyx::itm::minimize_tag> const&, baryonyx::solution&, int)
void convert(const raw_result<Mode>& source, solution& sol, int variables) { sol.value = source.value; sol.variables.resize(variables); for (int i = 0; i != variables; ++i) sol.variables[i] = static_cast<var_value>(source.x[i]); }
pushq %r15 pushq %r14 pushq %r12 pushq %rbx pushq %rax vmovsd 0x10(%rdi), %xmm0 movslq %edx, %r15 movq %rdi, %r14 movq %rsi, %rbx movq %rsi, %rdi vmovsd %xmm0, 0x18(%rsi) movq %r15, %rsi callq 0x41362 movl %r15d, %r12d xorl %r15d, %r15d cmpq %r15, %r12 je 0x4f4cd movq %r14, %rdi movl %r15d, %esi callq 0x3664a movq (%rbx), %rcx movb %al, (%rcx,%r15) incq %r15 jmp 0x4f4b1 addq $0x8, %rsp popq %rbx popq %r12 popq %r14 popq %r15 retq nop
/quesnel[P]baryonyx/lib/src/result.hpp
baryonyx::itm::storage<baryonyx::itm::default_cost_type<float>, baryonyx::itm::minimize_tag>::storage(std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>&, baryonyx::itm::default_cost_type<float> const&, double, int, int, std::vector<baryonyx::itm::merged_constraint, std::allocator<baryonyx::itm::merged_constraint>> const&)
storage(random_engine& rng, const Cost& costs_, const double cost_constant_, const int population_size, const int variables, const std::vector<merged_constraint>& constraints_) : m_indices(population_size) , m_data(population_size) , m_bastert(variables) , m_random(variables) , costs(costs_) , cost_constant(cost_constant_) , m_size(population_size) { for (auto& elem : m_data) elem.x = bit_array(variables); init_with_bastert<Cost, Mode>(m_bastert, costs_, variables, 0); for (int i = 0, e = m_size / 2; i != e; ++i) { m_data[i].x = m_bastert; std::bernoulli_distribution dist( std::clamp(static_cast<double>(i) / (5 * e), 0.0, 1.0)); for (int v = 0; v != variables; ++v) if (dist(rng)) m_data[i].x.invert(v); } for (int i = m_size / 2, e = m_size; i + 1 < e; i += 2) { init_with_random(m_data[i].x, rng, variables, 0.2); init_with_random(m_data[i + 1].x, rng, variables, 0.8); init_with_pre_solve<Cost, Mode>( m_data[i].x, m_data[i + 1].x, rng, costs_, constraints_, std::clamp(static_cast<double>(i) / (5 * e), 0.0, 1.0)); } for (int i = 0, e = m_size; i != e; ++i) { m_data[i].make_hash(); m_data[i].value = costs.results(m_data[i].x, cost_constant_); m_data[i].remaining_constraints = 0; for (int k = 0, end_k = length(constraints_); k != end_k; ++k) { int sum = 0; for (const auto& elem : constraints_[k].elements) { if (m_data[i].x[elem.variable_index]) sum += elem.factor; } if (!(constraints_[k].min <= sum && sum <= constraints_[k].max)) ++m_data[i].remaining_constraints; } } std::iota(std::begin(m_indices), std::end(m_indices), 0); sort(); }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x68, %rsp vmovsd %xmm0, 0x40(%rsp) vxorpd %xmm0, %xmm0, %xmm0 movq %rdx, 0x18(%rsp) movq %rdi, %r15 movslq %ecx, %r12 leaq 0x58(%rsp), %rdx movq %rsi, %r13 movq %r9, 0x28(%rsp) movl %r8d, %ebp movl %ecx, %ebx vmovupd %ymm0, 0x18(%rdi) vmovupd %ymm0, (%rdi) addq $0x38, %rdi movq %r12, %rsi movq %rdi, 0x48(%rsp) vzeroupper callq 0x3140c leaq 0x50(%r15), %r14 leaq 0x58(%rsp), %rdx movq %r14, %rdi movq %r12, %rsi callq 0x4f90a leaq 0x68(%r15), %rdi movl %ebp, %esi movq %rdi, 0x10(%rsp) callq 0x368ae leaq 0x78(%r15), %rdi movl %ebp, %esi callq 0x368ae vmovsd 0x40(%rsp), %xmm0 movq 0x18(%rsp), %rax movq %r15, 0x8(%rsp) leaq 0x58(%rsp), %r12 movq %rax, 0x88(%r15) vmovsd %xmm0, 0x90(%r15) movl %ebx, 0x98(%r15) movq 0x50(%r15), %rbx movq 0x58(%r15), %r15 cmpq %r15, %rbx je 0x4f5eb movq %r12, %rdi movl %ebp, %esi callq 0x368ae movq %rbx, %rdi movq %r12, %rsi callq 0x3696c leaq 0x60(%rsp), %rdi callq 0x357fe addq $0x38, %rbx jmp 0x4f5c1 movq 0x10(%rsp), %rdi movq 0x18(%rsp), %rsi xorl %r15d, %r15d movl %ebp, %edx xorl %ecx, %ecx callq 0x4f95d movq 0x8(%rsp), %rax movl 0x98(%rax), %eax pushq $0x2 popq %rcx cltd idivl %ecx movq %rax, 0x20(%rsp) leal (%rax,%rax,4), %eax vcvtsi2sd %eax, %xmm1, %xmm0 vmovsd %xmm0, 0x50(%rsp) cmpq 0x20(%rsp), %r15 je 0x4f69d movq (%r14), %rdi imulq $0x38, %r15, %r12 addq %r12, %rdi movq 0x10(%rsp), %rsi callq 0x36a44 vcvtsi2sd %r15d, %xmm3, %xmm0 vdivsd 0x50(%rsp), %xmm0, %xmm0 vmovsd 0x4049e6(%rip), %xmm1 # 0x454038 xorl %ebx, %ebx vminsd %xmm0, %xmm1, %xmm2 vxorpd %xmm1, %xmm1, %xmm1 vcmpltsd %xmm1, %xmm0, %k1 vmovsd %xmm1, %xmm2, %xmm2 {%k1} vmovapd %xmm2, 0x30(%rsp) cmpl %ebx, %ebp je 0x4f698 movq %r13, %rdi callq 0x36ac3 vmovapd 0x30(%rsp), %xmm1 vucomisd %xmm0, %xmm1 jbe 0x4f694 movq (%r14), %rdi movl %ebx, %esi addq %r12, %rdi callq 0x3626e incl %ebx jmp 0x4f66f incq %r15 jmp 0x4f624 movq 0x8(%rsp), %rax movslq 0x98(%rax), %rsi movl %esi, %eax cltd pushq $0x2 popq %rcx idivl %ecx leal (%rsi,%rsi,4), %ecx movq %rsi, 0x30(%rsp) vcvtsi2sd %ecx, %xmm3, %xmm0 vmovsd %xmm0, 0x10(%rsp) movslq %eax, %r12 movl %eax, %r15d imulq $0x38, %r12, %rbx incq %r12 cmpq 0x30(%rsp), %r12 jge 0x4f763 vmovsd 0x40a3a5(%rip), %xmm0 # 0x459a88 movq (%r14), %rdi movq %r13, %rsi movl %ebp, %edx addq %rbx, %rdi callq 0x362ac vmovsd 0x40a395(%rip), %xmm0 # 0x459a90 movq (%r14), %rax movq %r13, %rsi movl %ebp, %edx leaq 0x38(%rax,%rbx), %rdi callq 0x362ac vcvtsi2sd %r15d, %xmm3, %xmm0 vdivsd 0x10(%rsp), %xmm0, %xmm1 vmovsd 0x404918(%rip), %xmm0 # 0x454038 movq (%r14), %rdi movq 0x18(%rsp), %rcx movq 0x28(%rsp), %r8 vxorpd %xmm2, %xmm2, %xmm2 movq %r13, %rdx leaq 0x38(%rdi,%rbx), %rsi addq %rbx, %rdi vcmpltsd %xmm2, %xmm1, %k1 vminsd %xmm1, %xmm0, %xmm0 vmovsd %xmm2, %xmm0, %xmm0 {%k1} callq 0x4f9c9 addl $0x2, %r15d addq $0x70, %rbx addq $0x2, %r12 jmp 0x4f6d0 movq 0x8(%rsp), %rax movl 0x98(%rax), %eax movq %rax, 0x20(%rsp) xorl %eax, %eax cmpq 0x20(%rsp), %rax je 0x4f85a movq 0x8(%rsp), %rbx imulq $0x38, %rax, %rbp movq %rax, 0x10(%rsp) movq 0x50(%rbx), %rdi addq %rbp, %rdi callq 0x4fc80 vmovsd 0x40(%rsp), %xmm0 movq 0x50(%rbx), %rsi movq 0x88(%rbx), %rdi addq %rbp, %rsi callq 0x365d4 movq 0x50(%rbx), %rax vmovsd %xmm0, 0x10(%rax,%rbp) andl $0x0, 0x30(%rax,%rbp) movq 0x28(%rsp), %rax movq (%rax), %rcx movq 0x8(%rax), %rax subq %rcx, %rax cqto pushq $0x28 popq %rsi idivq %rsi movl %eax, %eax movq %rax, 0x18(%rsp) xorl %eax, %eax cmpq 0x18(%rsp), %rax je 0x4f84d imulq $0x28, %rax, %r12 movq %rax, 0x30(%rsp) xorl %r15d, %r15d movq (%rcx,%r12), %r13 movq 0x8(%rcx,%r12), %rbx cmpq %rbx, %r13 je 0x4f823 movq (%r14), %rdi movl 0x4(%r13), %esi addq %rbp, %rdi callq 0x3664a testl %eax, %eax je 0x4f81a movl (%r13), %eax addl %eax, %r15d addq $0x8, %r13 jmp 0x4f7fe movq 0x28(%rsp), %rax movq (%rax), %rcx cmpl %r15d, 0x18(%rcx,%r12) jg 0x4f83c addq %rcx, %r12 cmpl 0x1c(%r12), %r15d jle 0x4f843 movq (%r14), %rax incl 0x30(%rax,%rbp) movq 0x30(%rsp), %rax incq %rax jmp 0x4f7e2 movq 0x10(%rsp), %rax incq %rax jmp 0x4f775 movq 0x8(%rsp), %rdi xorl %edx, %edx movq 0x38(%rdi), %rax movq 0x40(%rdi), %rcx cmpq %rcx, %rax je 0x4f878 movl %edx, (%rax) incl %edx addq $0x4, %rax jmp 0x4f869 callq 0x4fca0 addq $0x68, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq movq %rax, %rbx jmp 0x4f8b3 movq %rax, %rbx jmp 0x4f8bf movq %rax, %rbx jmp 0x4f8c7 jmp 0x4f89f jmp 0x4f89f movq 0x8(%rsp), %r15 movq %rax, %rbx leaq 0x80(%r15), %rdi callq 0x357fe addq $0x70, %r15 movq %r15, %rdi callq 0x357fe movq %r14, %rdi callq 0x4fd7c movq 0x48(%rsp), %rdi callq 0x26a34 movq %rbx, %rdi callq 0xb3d0 nop
/quesnel[P]baryonyx/lib/src/itm-optimizer-common.hpp
void baryonyx::itm::init_with_bastert<baryonyx::itm::default_cost_type<float>, baryonyx::itm::minimize_tag>(baryonyx::bit_array&, baryonyx::itm::default_cost_type<float> const&, int, int)
void init_with_bastert(bit_array& x, const Cost& c, const int variables, const int value_if_0) noexcept { for (int i = 0; i != variables; ++i) if (init_x<Mode>(c[i], value_if_0)) x.set(i); else x.unset(i); }
pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx movl %ecx, %ebx movq %rsi, %r14 movq %rdi, %r15 movl %edx, %r13d xorl %r12d, %r12d cmpq %r12, %r13 je 0x4f9bf movq 0x8(%r14), %rcx testl %ebx, %ebx vxorps %xmm1, %xmm1, %xmm1 setne %al vmovss (%rcx,%r12,4), %xmm0 vucomiss %xmm0, %xmm1 setnp %dl sete %cl vucomiss %xmm0, %xmm1 ja 0x4f9af andb %dl, %cl andb %cl, %al jne 0x4f9af movq %r15, %rdi movl %r12d, %esi callq 0x36a06 jmp 0x4f9ba movq %r15, %rdi movl %r12d, %esi callq 0x369c8 incq %r12 jmp 0x4f974 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 retq
/quesnel[P]baryonyx/lib/src/itm-common.hpp
void baryonyx::itm::init_with_pre_solve<baryonyx::itm::default_cost_type<float>, baryonyx::itm::minimize_tag>(baryonyx::bit_array&, baryonyx::bit_array&, std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>&, baryonyx::itm::default_cost_type<float> const&, std::vector<baryonyx::itm::merged_constraint, std::allocator<baryonyx::itm::merged_constraint>> const&, double)
void init_with_pre_solve(bit_array& x_pessimistic, bit_array& x_optimistic, random_engine& rng, const Cost& c, const std::vector<merged_constraint>& constraints, const double init_random) noexcept { int max_length = 0; for (const auto& cst : constraints) if (length(cst.elements) > max_length) max_length = length(cst.elements); struct reduced_cost { float value; int factor; int id; }; std::vector<reduced_cost> R(max_length); std::bernoulli_distribution dist(init_random); for (const auto& cst : constraints) { if (!dist(rng)) continue; R.resize(cst.elements.size()); const int r_size = length(cst.elements); for (int i = 0; i != r_size; ++i) { R[i].value = static_cast<float>(c[cst.elements[i].variable_index]); R[i].factor = cst.elements[i].factor; R[i].id = cst.elements[i].variable_index; } std::shuffle(std::begin(R), std::end(R), rng); std::sort( std::begin(R), std::end(R), [](const auto& lhs, const auto& rhs) { return is_better_solution<Mode>(lhs.value, rhs.value); }); if (!x_pessimistic.empty()) { int sum = 0; int best = -2; for (int i = -1; i < r_size; ++i) { if (cst.min <= sum && sum <= cst.max) { best = i; break; } if (i + 1 < r_size) sum += R[i + 1].factor; } int i = 0; for (; i <= best; ++i) x_pessimistic.set(R[i].id); for (; i != r_size; ++i) { x_pessimistic.unset(R[i].id); } } if (!x_optimistic.empty()) { int sum = 0; int best = -2; for (int i = -1; i < r_size; ++i) { if (cst.min <= sum && sum <= cst.max) best = i; if (best != -2 && i + 1 < r_size && stop_iterating<Mode>(R[i + 1].value)) break; if (i + 1 < r_size) sum += R[i + 1].factor; } int i = 0; for (; i <= best; ++i) x_optimistic.set(R[i].id); for (; i != r_size; ++i) x_optimistic.unset(R[i].id); } } }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x58, %rsp movq %rcx, 0x38(%rsp) movq (%r8), %rax movq 0x8(%r8), %rcx movq %rdx, 0x30(%rsp) vmovsd %xmm0, 0x48(%rsp) movq %r8, %r13 xorl %edx, %edx movq %rsi, 0x28(%rsp) movq %rdi, 0x20(%rsp) cmpq %rcx, %rax je 0x4fa1a movq 0x8(%rax), %rsi subq (%rax), %rsi shrq $0x3, %rsi cmpl %esi, %edx cmovgl %edx, %esi addq $0x28, %rax movl %esi, %edx jmp 0x4f9fd movl %edx, %esi leaq 0x8(%rsp), %rdi leaq 0x7(%rsp), %rdx callq 0x4fee8 movq 0x8(%r13), %rax movq (%r13), %rbp movq 0x30(%rsp), %r13 movq %rax, 0x50(%rsp) cmpq 0x50(%rsp), %rbp je 0x4fc5d movq %r13, %rdi callq 0x36ac3 vmovsd 0x48(%rsp), %xmm1 vucomisd %xmm0, %xmm1 jbe 0x4fc54 movq 0x8(%rbp), %rsi subq (%rbp), %rsi sarq $0x3, %rsi leaq 0x8(%rsp), %rdi callq 0x4ff3c movq 0x38(%rsp), %rcx movq (%rbp), %rax movq 0x8(%rbp), %r15 movq 0x8(%rsp), %rdx movl $0x2003, %esi # imm = 0x2003 movq 0x8(%rcx), %rcx subq %rax, %r15 addq $0x4, %rdx bextrq %rsi, %r15, %r14 xorl %esi, %esi cmpq %rsi, %r14 je 0x4fac6 movq (%rax,%rsi,8), %rdi incq %rsi movq %rdi, %r8 sarq $0x20, %r8 vmovss (%rcx,%r8,4), %xmm0 vmovss %xmm0, -0x4(%rdx) movq %rdi, (%rdx) addq $0xc, %rdx jmp 0x4fa9f movq 0x8(%rsp), %rdi movq 0x10(%rsp), %rsi movq %r13, %rdx callq 0x4ff74 movq 0x8(%rsp), %rdi movq 0x10(%rsp), %rsi callq 0x503d7 movq 0x20(%rsp), %rax cmpq $0x0, 0x8(%rax) je 0x4fb92 movq 0x8(%rsp), %rax movq %r15, %rcx shrq $0x3, %rcx xorl %esi, %esi movslq %ecx, %rdx addq $0x4, %rax pushq $-0x1 popq %rcx movq %r15, 0x40(%rsp) imulq $0xc, %rcx, %rdi addq %rax, %rdi cmpq %rdx, %rcx jge 0x4fb3a cmpl %esi, 0x18(%rbp) jg 0x4fb2a cmpl 0x1c(%rbp), %esi jle 0x4fb3d incq %rcx addq $0xc, %rdi cmpq %rdx, %rcx jge 0x4fb1b addl (%rdi), %esi jmp 0x4fb14 pushq $-0x2 popq %rcx movslq %ecx, %r15 movq %r14, %rbx pushq $0x8 popq %r13 xorl %r12d, %r12d cmpq %r15, %r12 jg 0x4fb6e movq 0x8(%rsp), %rax movq 0x20(%rsp), %rdi movl (%rax,%r13), %esi callq 0x369c8 incq %r12 addq $0xc, %r13 decq %rbx jmp 0x4fb4a movq 0x40(%rsp), %r15 subq $0x1, %rbx jb 0x4fb92 movq 0x8(%rsp), %rax movq 0x20(%rsp), %rdi movl (%rax,%r13), %esi callq 0x36a06 addq $0xc, %r13 jmp 0x4fb73 movq 0x28(%rsp), %rax movq 0x30(%rsp), %r13 cmpq $0x0, 0x8(%rax) je 0x4fc54 movq 0x8(%rsp), %rax shrq $0x3, %r15 xorl %edx, %edx movslq %r15d, %rcx addq $0xc, %rax pushq $-0x1 popq %rsi pushq $-0x2 popq %rdi imulq $0xc, %rsi, %r8 addq %rax, %r8 movl %edi, %r9d cmpq %rcx, %rsi jge 0x4fc0c cmpl 0x1c(%rbp), %edx movl %esi, %edi cmovgl %r9d, %edi cmpl %edx, 0x18(%rbp) cmovgl %r9d, %edi incq %rsi cmpl $-0x2, %edi je 0x4fbfa cmpq %rcx, %rsi jge 0x4fbfa vmovss (%r8), %xmm0 vucomiss 0x409ec0(%rip), %xmm0 # 0x459ab8 ja 0x4fc09 addq $0xc, %r8 cmpq %rcx, %rsi jge 0x4fbc6 addl -0x8(%r8), %edx jmp 0x4fbbf movl %edi, %r9d movslq %r9d, %r15 pushq $0x8 popq %rbx xorl %r12d, %r12d cmpq %r15, %r12 jg 0x4fc4e movq 0x8(%rsp), %rax movq 0x28(%rsp), %rdi movl (%rax,%rbx), %esi callq 0x369c8 incq %r12 addq $0xc, %rbx decq %r14 jmp 0x4fc15 movq 0x8(%rsp), %rax movq 0x28(%rsp), %rdi movl (%rax,%rbx), %esi callq 0x36a06 addq $0xc, %rbx subq $0x1, %r14 jae 0x4fc38 addq $0x28, %rbp jmp 0x4fa3d leaq 0x8(%rsp), %rdi callq 0x50180 addq $0x58, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq jmp 0x4fc78 movq %rax, %rdi callq 0xeb9f
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::itm::optimize_functor<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::minimize_tag, baryonyx::itm::default_cost_type<float>>, float, baryonyx::itm::minimize_tag, baryonyx::itm::default_cost_type<float>>::operator()(std::atomic<bool> const&, baryonyx::itm::best_solution_recorder<baryonyx::itm::default_cost_type<float>, float, baryonyx::itm::minimize_tag>&, std::vector<baryonyx::itm::merged_constraint, std::allocator<baryonyx::itm::merged_constraint>> const&, int, baryonyx::itm::default_cost_type<float> const&, double)
void operator()(const std::atomic_bool& stop_task, best_solution_recorder<Cost, Float, Mode>& best_recorder, const std::vector<merged_constraint>& constraints, int variables, const Cost& original_costs, double cost_constant) { bit_array x(variables); auto& p = m_ctx.parameters; auto norm_costs = normalize_costs<Float, Cost>( m_ctx, original_costs, m_local_ctx.rng, variables); const auto kappa_step = static_cast<Float>(p.kappa_step); const auto kappa_max = static_cast<Float>(p.kappa_max); const auto alpha = static_cast<Float>(p.alpha); const auto theta = static_cast<Float>(p.theta); const auto delta = p.delta < 0 ? compute_delta<Float, Cost>(m_ctx, norm_costs, theta, variables) : static_cast<Float>(p.delta); const auto pushing_k_factor = static_cast<Float>(p.pushing_k_factor); const auto pushing_objective_amplifier = static_cast<Float>(p.pushing_objective_amplifier); const auto w_limit = static_cast<long int>(p.w); Solver slv(m_local_ctx.rng, length(constraints), variables, norm_costs, constraints); compute_order compute(p.order, variables); bool is_a_solution = false; while (!stop_task.load()) { ++m_call_number; const auto kappa_start = static_cast<Float>(best_recorder.reinit( m_local_ctx, is_a_solution, p.kappa_min, p.kappa_max, x)); auto kappa = kappa_start; compute.init(slv, x); auto best_remaining = INT_MAX; is_a_solution = false; for (long int i = 0; !stop_task.load() && i != p.limit; ++i) { auto remaining = compute.run(slv, x, m_local_ctx.rng, kappa, delta, theta); if (remaining == 0) { best_recorder.try_update( m_local_ctx, x, original_costs.results(x, cost_constant), i); best_remaining = 0; is_a_solution = true; break; } else { best_remaining = std::min(remaining, best_remaining); } if (i > w_limit) kappa += kappa_step * std::pow(static_cast<Float>(remaining) / static_cast<Float>(slv.m), alpha); if (kappa > kappa_max) break; } if (best_remaining > 0) { best_recorder.try_advance( m_local_ctx, x, best_remaining, p.limit); continue; } for (int push = 0; !stop_task.load() && push < p.pushes_limit; ++push) { auto remaining = compute.push_and_run(slv, x, m_local_ctx.rng, pushing_k_factor, delta, theta, pushing_objective_amplifier); if (remaining == 0) { best_recorder.try_update( m_local_ctx, x, original_costs.results(x, cost_constant), -push * p.pushing_iteration_limit - 1); is_a_solution = true; } kappa = kappa_start; for (int iter = 0; !stop_task.load() && iter < p.pushing_iteration_limit; ++iter) { remaining = compute.run( slv, x, m_local_ctx.rng, kappa, delta, theta); if (remaining == 0) { best_recorder.try_update( m_local_ctx, x, original_costs.results(x, cost_constant), -push * p.pushing_iteration_limit - iter - 1); is_a_solution = true; break; } if (iter > p.w) kappa += kappa_step * std::pow(static_cast<Float>(remaining) / static_cast<Float>(slv.m), alpha); if (kappa > kappa_max) break; } } } }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x158, %rsp # imm = 0x158 movq %rdi, %rbp leaq 0x20(%rsp), %rdi movq %rsi, %r15 movl %r8d, %esi vmovsd %xmm0, 0x60(%rsp) movq %r9, %r12 movl %r8d, %ebx movq %rcx, %r14 movq %rdx, 0x30(%rsp) callq 0x368ae movq (%rbp), %r13 movq %rbp, 0x78(%rsp) addq $0x8, %rbp leaq 0x80(%rsp), %rdi movq %r13, %rsi movq %r12, 0x58(%rsp) movq %r12, %rdx movq %rbp, %rcx movl %ebx, %r8d callq 0x38959 vmovsd 0x20(%r13), %xmm0 vmovsd 0x10(%r13), %xmm2 vxorpd %xmm1, %xmm1, %xmm1 vmovsd %xmm0, 0x8(%rsp) vmovsd 0x28(%r13), %xmm0 vucomisd %xmm2, %xmm1 vmovsd %xmm0, 0x50(%rsp) vmovsd 0x30(%r13), %xmm0 vmovsd %xmm0, 0x48(%rsp) vcvtsd2ss 0x8(%r13), %xmm3, %xmm0 vmovss %xmm0, 0x14(%rsp) jbe 0x51382 movq 0x78(%rsp), %rax movq (%rax), %rdi leaq 0x80(%rsp), %rsi movl %ebx, %edx callq 0x38a37 vmovss %xmm0, 0x10(%rsp) jmp 0x5138c vcvtsd2ss %xmm2, %xmm2, %xmm0 vmovss %xmm0, 0x10(%rsp) vcvttsd2si 0xa0(%r13), %rax vmovsd 0x38(%r13), %xmm0 vmovsd 0x40(%r13), %xmm1 movq %rax, 0x90(%rsp) movq 0x8(%r14), %rax vmovsd %xmm0, 0x40(%rsp) vmovsd %xmm1, 0x68(%rsp) subq (%r14), %rax pushq $0x28 popq %rcx cqto idivq %rcx leaq 0xd0(%rsp), %rdi leaq 0x80(%rsp), %r8 movq %rbp, %rsi movl %eax, %edx movl %ebx, %ecx movq %r14, %r9 callq 0x517ea movl 0xcc(%r13), %esi leaq 0x98(%rsp), %rdi movl %ebx, %edx callq 0x38cd8 vcvtsd2ss 0x8(%rsp), %xmm3, %xmm0 vmovss %xmm0, 0x3c(%rsp) vcvtsd2ss 0x50(%rsp), %xmm3, %xmm0 vmovss %xmm0, 0x50(%rsp) vcvtsd2ss 0x48(%rsp), %xmm3, %xmm0 vmovss %xmm0, 0x48(%rsp) vcvtsd2ss 0x40(%rsp), %xmm3, %xmm0 vmovss %xmm0, 0x74(%rsp) vcvtsd2ss 0x68(%rsp), %xmm3, %xmm0 vmovss %xmm0, 0x70(%rsp) movq $0x0, 0x18(%rsp) movb (%r15), %al testb $0x1, %al jne 0x51751 movq 0x78(%rsp), %rax incq 0xb0(%rax) vmovsd 0x18(%r13), %xmm0 vmovsd 0x28(%r13), %xmm1 movzbl 0x18(%rsp), %edx movq 0x30(%rsp), %rdi leaq 0x20(%rsp), %rbx movq %rbp, %rsi movq %rbx, %rcx andl $0x1, %edx callq 0x51a12 vmovsd %xmm0, 0x8(%rsp) leaq 0x98(%rsp), %rdi leaq 0xd0(%rsp), %rsi movq %rbx, %rdx callq 0x51b12 vcvtsd2ss 0x8(%rsp), %xmm3, %xmm0 movl $0x7fffffff, %ebx # imm = 0x7FFFFFFF xorl %r14d, %r14d vmovss %xmm0, 0x68(%rsp) movb (%r15), %al testb $0x1, %al jne 0x5154f cmpq 0xb0(%r13), %r14 je 0x5154f vmovss 0x10(%rsp), %xmm1 vmovss 0x14(%rsp), %xmm2 leaq 0x98(%rsp), %rdi leaq 0xd0(%rsp), %rsi leaq 0x20(%rsp), %rdx movq %rbp, %rcx vmovss %xmm0, 0x8(%rsp) callq 0x51b54 testl %eax, %eax je 0x51567 cmpl %eax, %ebx cmovgel %eax, %ebx cmpq 0x90(%rsp), %r14 jle 0x51539 vcvtsi2ss %eax, %xmm3, %xmm0 vcvtsi2ssl 0x150(%rsp), %xmm3, %xmm1 vdivss %xmm1, %xmm0, %xmm0 vmovss 0x48(%rsp), %xmm1 callq 0xb530 vmovss 0x8(%rsp), %xmm1 vfmadd231ss 0x3c(%rsp), %xmm0, %xmm1 # xmm1 = (xmm0 * mem) + xmm1 vmovaps %xmm1, %xmm0 jmp 0x5153f vmovss 0x8(%rsp), %xmm0 vucomiss 0x50(%rsp), %xmm0 ja 0x5154f incq %r14 jmp 0x514b0 testl %ebx, %ebx jg 0x51731 leaq 0x20(%rsp), %rbx movq $0x0, 0x18(%rsp) jmp 0x51599 vmovsd 0x60(%rsp), %xmm0 movq 0x58(%rsp), %rdi leaq 0x20(%rsp), %rbx movq %rbx, %rsi callq 0x365d4 movq 0x30(%rsp), %rdi movq %rbp, %rsi movq %rbx, %rdx movq %r14, %rcx callq 0x51d60 movb $0x1, %al movq %rax, 0x18(%rsp) xorl %r14d, %r14d movl $0x0, 0x40(%rsp) movb (%r15), %al testb $0x1, %al jne 0x5143e cmpl 0xbc(%r13), %r14d jge 0x5143e vmovss 0x74(%rsp), %xmm0 vmovss 0x10(%rsp), %xmm1 vmovss 0x14(%rsp), %xmm2 vmovss 0x70(%rsp), %xmm3 leaq 0x98(%rsp), %rdi leaq 0xd0(%rsp), %rsi movq %rbx, %rdx movq %rbp, %rcx callq 0x51e6a testl %eax, %eax jne 0x5162d vmovsd 0x60(%rsp), %xmm0 movq 0x58(%rsp), %rdi movq %rbx, %rsi callq 0x365d4 movl 0xc0(%r13), %eax movq 0x30(%rsp), %rdi movq %rbp, %rsi movq %rbx, %rdx imull %r14d, %eax notl %eax movslq %eax, %rcx callq 0x51d60 movb $0x1, %al movq %rax, 0x18(%rsp) pushq $0x1 popq %rax vmovss 0x68(%rsp), %xmm0 movl %eax, %ebx movb (%r15), %al testb $0x1, %al jne 0x516db leal -0x1(%rbx), %r12d cmpl 0xc0(%r13), %r12d jge 0x516db vmovss 0x10(%rsp), %xmm1 vmovss 0x14(%rsp), %xmm2 leaq 0x98(%rsp), %rdi leaq 0xd0(%rsp), %rsi leaq 0x20(%rsp), %rdx movq %rbp, %rcx vmovss %xmm0, 0x8(%rsp) callq 0x51b54 testl %eax, %eax je 0x516e2 vcvtsi2sd %r12d, %xmm4, %xmm0 vucomisd 0xa0(%r13), %xmm0 jbe 0x516c6 vcvtsi2ss %eax, %xmm4, %xmm0 vcvtsi2ssl 0x150(%rsp), %xmm4, %xmm1 vdivss %xmm1, %xmm0, %xmm0 vmovss 0x48(%rsp), %xmm1 callq 0xb530 vmovss 0x8(%rsp), %xmm1 vfmadd231ss 0x3c(%rsp), %xmm0, %xmm1 # xmm1 = (xmm0 * mem) + xmm1 vmovaps %xmm1, %xmm0 jmp 0x516cc vmovss 0x8(%rsp), %xmm0 vucomiss 0x50(%rsp), %xmm0 ja 0x516db incl %ebx jmp 0x51638 leaq 0x20(%rsp), %rbx jmp 0x51725 vmovsd 0x60(%rsp), %xmm0 movq 0x58(%rsp), %rdi leaq 0x20(%rsp), %r12 movq %r12, %rsi callq 0x365d4 movl 0xc0(%r13), %eax movq 0x30(%rsp), %rdi movq %rbp, %rsi movq %r12, %rdx imull 0x40(%rsp), %eax subl %ebx, %eax movq %r12, %rbx movslq %eax, %rcx callq 0x51d60 movb $0x1, %al movq %rax, 0x18(%rsp) decl 0x40(%rsp) incl %r14d jmp 0x515a4 movq 0xb0(%r13), %r8 movq 0x30(%rsp), %rdi leaq 0x20(%rsp), %rdx movq %rbp, %rsi movl %ebx, %ecx callq 0x51de8 jmp 0x51435 leaq 0x98(%rsp), %rdi callq 0x393ac leaq 0xd0(%rsp), %rdi callq 0x5208c leaq 0x88(%rsp), %rdi callq 0x35c1a leaq 0x28(%rsp), %rdi callq 0x357fe addq $0x158, %rsp # imm = 0x158 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq jmp 0x5179b movq %rax, %rbx jmp 0x517bd movq %rax, %rbx jmp 0x517ca movq %rax, %rbx jmp 0x517d7 jmp 0x517ad jmp 0x517ad jmp 0x517ad jmp 0x517ad leaq 0x98(%rsp), %rdi movq %rax, %rbx callq 0x393ac leaq 0xd0(%rsp), %rdi callq 0x5208c leaq 0x88(%rsp), %rdi callq 0x35c1a leaq 0x28(%rsp), %rdi callq 0x357fe movq %rbx, %rdi callq 0xb3d0 nop
/quesnel[P]baryonyx/lib/src/itm-optimizer-common.hpp
baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::minimize_tag, baryonyx::itm::default_cost_type<float>>::solver_random_inequalities_101coeff(std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>&, int, int, baryonyx::itm::default_cost_type<float> const&, std::vector<baryonyx::itm::merged_constraint, std::allocator<baryonyx::itm::merged_constraint>> const&)
solver_random_inequalities_101coeff( random_engine& rng_, int m_, int n_, const cost_type& c_, const std::vector<merged_constraint>& csts) : rng(rng_) , ap(csts, m_, n_) , A(std::make_unique<int[]>(ap.size())) , R(std::make_unique<rc_data[]>(compute_reduced_costs_vector_size(csts))) , b(std::make_unique<bound_factor[]>(m_)) , pi(std::make_unique<Float[]>(m_)) , P(std::make_unique<Float[]>(ap.size())) , c(c_) , dist(0.5) , m(m_) , n(n_) { int id = 0; for (int i = 0, e = length(csts); i != e; ++i) { int lower = 0, upper = 0; for (const auto& cst : csts[i].elements) { bx_ensures(std::abs(cst.factor) == 1); A[id++] = cst.factor; if (cst.factor > 0) upper++; else lower++; } if (csts[i].min == csts[i].max) { b[i].min = csts[i].min; b[i].max = csts[i].max; } else { b[i].min = std::max(-lower, csts[i].min); b[i].max = std::min(upper, csts[i].max); } bx_ensures(b[i].min <= b[i].max); } }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x28, %rsp leaq 0x8(%rdi), %r13 movq %rsi, (%rdi) movq %rdi, %r15 movq %r9, %r12 movq %r8, 0x20(%rsp) movl %edx, %r14d movq %r9, %rsi movl %ecx, 0x4(%rsp) movq %r13, %rdi callq 0x3a4ca movl 0x30(%r15), %esi leaq 0x48(%r15), %rbx movq %rbx, %rdi movq %r13, 0x18(%rsp) callq 0x28eb6 movq %r12, %rdi leaq 0x50(%r15), %rbp callq 0x3a89d movq %rbp, 0x10(%rsp) movq %rbp, %rdi movq %rax, %rsi callq 0x520ca movslq %r14d, %rbp leaq 0x58(%r15), %rdi movq %rbp, %rsi movq %rdi, 0x8(%rsp) callq 0x52107 leaq 0x60(%r15), %r13 movq %r13, %rdi movq %rbp, %rsi callq 0x35bd8 movl 0x30(%r15), %esi leaq 0x68(%r15), %rdi callq 0x35bd8 movq 0x20(%rsp), %rax movq %rax, 0x70(%r15) movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000 movq %rax, 0x78(%r15) movl 0x4(%rsp), %eax movl %r14d, 0x80(%r15) movl %eax, 0x84(%r15) movq (%r12), %rcx movq 0x8(%r12), %rax subq %rcx, %rax pushq $0x28 popq %rsi cqto xorl %edi, %edi idivq %rsi movq 0x58(%r15), %rdx xorl %esi, %esi movl %eax, %eax cmpq %rax, %rsi je 0x51994 imulq $0x28, %rsi, %r8 movq (%rbx), %r15 movslq %edi, %rdi xorl %r10d, %r10d movq (%rcx,%r8), %r11 movq 0x8(%rcx,%r8), %r14 leaq (%rcx,%r8), %r9 xorl %r8d, %r8d cmpq %r14, %r11 je 0x51927 movl (%r11), %r12d leal 0x1(%r12), %ebp testl $0xfffffffd, %ebp # imm = 0xFFFFFFFD jne 0x519a3 movl %r12d, (%r15,%rdi,4) incq %rdi xorl %ebp, %ebp xorl %r12d, %r12d cmpl $0x0, (%r11) setle %bpl setg %r12b addq $0x8, %r11 addl %r12d, %r10d addl %ebp, %r8d jmp 0x518ea movl 0x18(%r9), %r11d cmpl 0x1c(%r9), %r11d jne 0x5193e imulq $0xc, %rsi, %r8 movl %r11d, (%rdx,%r8) movl %r11d, %r8d jmp 0x5195e negl %r8d cmpl %r8d, %r11d cmovgl %r11d, %r8d imulq $0xc, %rsi, %r11 movl %r8d, (%rdx,%r11) movl 0x1c(%r9), %r9d cmpl %r10d, %r9d cmovll %r9d, %r10d movl %r10d, %r11d imulq $0xc, %rsi, %r9 incq %rsi movl %r11d, 0x4(%rdx,%r9) cmpl %r11d, %r8d jle 0x518c4 leaq 0x406ab0(%rip), %rdi # 0x45842a leaq 0x408928(%rip), %rsi # 0x45a2a9 leaq 0x4088bf(%rip), %rdx # 0x45a247 leaq 0x40892f(%rip), %rcx # 0x45a2be callq 0x2813f addq $0x28, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq leaq 0x406a80(%rip), %rdi # 0x45842a leaq 0x40887c(%rip), %rsi # 0x45a22d leaq 0x40888f(%rip), %rdx # 0x45a247 leaq 0x4088e7(%rip), %rcx # 0x45a2a6 callq 0x2813f movq %r13, %rdi movq %rax, %r14 callq 0x35c1a jmp 0x519d4 movq %rax, %r14 movq 0x8(%rsp), %rdi callq 0x52144 jmp 0x519e3 movq %rax, %r14 movq 0x10(%rsp), %rdi callq 0x5215e jmp 0x519f2 movq %rax, %r14 movq %rbx, %rdi callq 0x28fb6 jmp 0x519ff movq %rax, %r14 movq 0x18(%rsp), %rdi callq 0x3a954 movq %r14, %rdi callq 0xb3d0 nop
/quesnel[P]baryonyx/lib/src/random-solver.cpp
baryonyx::itm::best_solution_recorder<baryonyx::itm::default_cost_type<float>, float, baryonyx::itm::minimize_tag>::reinit(baryonyx::itm::local_context&, bool, double, double, baryonyx::bit_array&)
double reinit(local_context& ctx, const bool /*is_solution*/, const double kappa_min, const double kappa_max, bit_array& x) { to_log(stdout, 3u, "- reinitinialization thread {}.\n", ctx.thread_id); double kappa = kappa_min; if (m_kappa_append[ctx.thread_id] < ctx.init_kappa_improve_stop) { m_kappa_append[ctx.thread_id] += ctx.init_kappa_improve_increase; kappa = kappa_min + (kappa_max - kappa_min) * m_kappa_append[ctx.thread_id]; to_log(stdout, 5u, "- improve with kappa {}\n", kappa); } else { m_kappa_append[ctx.thread_id] = ctx.init_kappa_improve_start; crossover(ctx, x); to_log(stdout, 5u, "- crossover\n"); } mutation(ctx, x); return kappa; }
pushq %r15 pushq %r14 pushq %r12 pushq %rbx subq $0x18, %rsp movq 0x5eb5a4(%rip), %r12 # 0x63cfc8 movq %rdi, %r15 movq %rcx, %rbx leaq 0x40892a(%rip), %rcx # 0x45a35b vmovsd %xmm1, 0x8(%rsp) vmovsd %xmm0, 0x10(%rsp) movq %rsi, %r14 leaq 0xa0(%rsi), %r8 movq (%r12), %rdi pushq $0x3 popq %rsi pushq $0x20 popq %rdx callq 0x3be57 vmovsd 0x10(%rsp), %xmm2 vmovsd %xmm2, (%rsp) movl 0xa0(%r14), %eax movq 0xa8(%r15), %rcx vmovsd 0x98(%r14), %xmm1 vmovsd (%rcx,%rax,8), %xmm0 vucomisd %xmm0, %xmm1 jbe 0x51ac0 vaddsd 0x90(%r14), %xmm0, %xmm0 vmovsd 0x8(%rsp), %xmm1 movq %rsp, %r8 vsubsd %xmm2, %xmm1, %xmm1 vmovsd %xmm0, (%rcx,%rax,8) leaq 0x4088d7(%rip), %rcx # 0x45a37c vfmadd213sd %xmm2, %xmm0, %xmm1 # xmm1 = (xmm0 * xmm1) + xmm2 movq (%r12), %rdi vmovsd %xmm1, (%r8) pushq $0x5 popq %rsi pushq $0x18 popq %rdx callq 0x3bea4 jmp 0x51af3 vmovsd 0x88(%r14), %xmm0 leaq 0x8(%r15), %rdi movq %r14, %rsi movq %rbx, %rdx vmovsd %xmm0, (%rcx,%rax,8) callq 0x522ee movq (%r12), %rdi leaq 0x4088ad(%rip), %rcx # 0x45a395 pushq $0x5 popq %rsi pushq $0xc popq %rdx callq 0x377fc movq %r15, %rdi movq %r14, %rsi movq %rbx, %rdx callq 0x52194 vmovsd (%rsp), %xmm0 addq $0x18, %rsp popq %rbx popq %r12 popq %r14 popq %r15 retq
/quesnel[P]baryonyx/lib/src/itm-optimizer-common.hpp
void baryonyx::itm::compute_order::init<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::minimize_tag, baryonyx::itm::default_cost_type<float>>, baryonyx::bit_array>(baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::minimize_tag, baryonyx::itm::default_cost_type<float>> const&, baryonyx::bit_array const&)
void init(const Solver& s, const Xtype& x) { switch (order) { case solver_parameters::constraint_order::infeasibility_decr: case solver_parameters::constraint_order::infeasibility_incr: infeasibility_local_compute_violated_constraints(s, x); break; case solver_parameters::constraint_order::pi_sign_change: std::iota(R.begin(), R.end(), 0); break; case solver_parameters::constraint_order::none: case solver_parameters::constraint_order::reversing: case solver_parameters::constraint_order::random_sorting: case solver_parameters::constraint_order::lagrangian_decr: case solver_parameters::constraint_order::lagrangian_incr: default: compute_violated_constraints(s, x, R); break; } }
movl 0x30(%rdi), %ecx movq %rdi, %rax leal -0x3(%rcx), %edi cmpl $0x2, %edi jae 0x51b28 movq %rax, %rdi jmp 0x525e8 cmpl $0x7, %ecx jne 0x51b45 movq (%rax), %rcx movq 0x8(%rax), %rax xorl %edx, %edx cmpq %rax, %rcx je 0x51b53 movl %edx, (%rcx) incl %edx addq $0x4, %rcx jmp 0x51b36 movq %rsi, %rdi movq %rdx, %rsi movq %rax, %rdx jmp 0x526ea retq
/quesnel[P]baryonyx/lib/src/itm-common.hpp
int baryonyx::itm::compute_order::run<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::minimize_tag, baryonyx::itm::default_cost_type<float>>, baryonyx::bit_array, float>(baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::minimize_tag, baryonyx::itm::default_cost_type<float>>&, baryonyx::bit_array&, std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>&, float, float, float)
int run(Solver& solver, Xtype& x, random_engine& rng, Float kappa, Float delta, Float theta) { bool pi_changed = false; int remaining = 0; switch (order) { case solver_parameters::constraint_order::reversing: solver.compute_update_row( x, R.crbegin(), R.crend(), kappa, delta, theta); return compute_violated_constraints(solver, x, R); case solver_parameters::constraint_order::random_sorting: std::shuffle(R.begin(), R.end(), rng); solver.compute_update_row( x, R.begin(), R.end(), kappa, delta, theta); return compute_violated_constraints(solver, x, R); case solver_parameters::constraint_order::infeasibility_decr: std::sort(m_order.begin(), m_order.end(), [](const auto& lhs, const auto& rhs) { return rhs.second < lhs.second; }); solver.compute_update_row( x, m_order.cbegin(), m_order.cend(), kappa, delta, theta); return infeasibility_local_compute_violated_constraints(solver, x); case solver_parameters::constraint_order::infeasibility_incr: std::sort(m_order.begin(), m_order.end(), [](const auto& lhs, const auto& rhs) { return lhs.second < rhs.second; }); solver.compute_update_row( x, m_order.cbegin(), m_order.cend(), kappa, delta, theta); return infeasibility_local_compute_violated_constraints(solver, x); case solver_parameters::constraint_order::lagrangian_decr: std::sort( R.begin(), R.end(), [&solver](const auto lhs, const auto rhs) { return solver.pi[rhs] < solver.pi[lhs]; }); solver.compute_update_row( x, R.cbegin(), R.cend(), kappa, delta, theta); return compute_violated_constraints(solver, x, R); case solver_parameters::constraint_order::lagrangian_incr: std::sort( R.begin(), R.end(), [&solver](const auto lhs, const auto rhs) { return solver.pi[lhs] < solver.pi[rhs]; }); solver.compute_update_row( x, R.cbegin(), R.cend(), kappa, delta, theta); return compute_violated_constraints(solver, x, R); case solver_parameters::constraint_order::pi_sign_change: std::shuffle(R.begin(), R.end(), rng); pi_changed = solver.compute_update_row( x, R.begin(), R.end(), kappa, delta, theta); remaining = local_compute_violated_constraints(solver, x); if (!pi_changed && remaining == 0) return 0; return remaining; case solver_parameters::constraint_order::none: default: solver.compute_update_row( x, R.begin(), R.end(), kappa, delta, theta); return compute_violated_constraints(solver, x, R); } }
pushq %r15 pushq %r14 pushq %rbx subq $0x20, %rsp movl 0x30(%rdi), %eax movq %rdx, %rbx movq %rsi, %r15 movq %rdi, %r14 decl %eax cmpl $0x6, %eax ja 0x51c93 leaq 0x40801d(%rip), %rdx # 0x459b98 movslq (%rdx,%rax,4), %rax addq %rdx, %rax jmpq *%rax movq 0x8(%r14), %rax leaq 0x18(%rsp), %rdx leaq 0x10(%rsp), %rcx movq %r15, %rdi movq %rbx, %rsi movq %rax, (%rdx) movq (%r14), %rax movq %rax, (%rcx) callq 0x527e0 movq %r15, %rdi movq %rbx, %rsi movq %r14, %rdx callq 0x526ea addq $0x20, %rsp popq %rbx popq %r14 popq %r15 retq movq (%r14), %rdi movq 0x8(%r14), %rsi movq %r15, %rdx vmovss %xmm2, 0xc(%rsp) vmovss %xmm1, 0x8(%rsp) vmovss %xmm0, 0x4(%rsp) callq 0x54b8d jmp 0x51cc8 movq 0x18(%r14), %rdi movq 0x20(%r14), %rsi vmovss %xmm2, 0xc(%rsp) vmovss %xmm1, 0x8(%rsp) vmovss %xmm0, 0x4(%rsp) callq 0x542b7 jmp 0x51c24 movq 0x18(%r14), %rdi movq 0x20(%r14), %rsi vmovss %xmm2, 0xc(%rsp) vmovss %xmm1, 0x8(%rsp) vmovss %xmm0, 0x4(%rsp) callq 0x54722 vmovss 0x4(%rsp), %xmm0 vmovss 0x8(%rsp), %xmm1 vmovss 0xc(%rsp), %xmm2 movq 0x18(%r14), %rdx movq 0x20(%r14), %rcx movq %r15, %rdi movq %rbx, %rsi callq 0x5309e movq %r14, %rdi movq %r15, %rsi movq %rbx, %rdx addq $0x20, %rsp popq %rbx popq %r14 popq %r15 jmp 0x534f6 movq (%r14), %rdi movq 0x8(%r14), %rsi movq %rcx, %rdx vmovss %xmm2, 0xc(%rsp) vmovss %xmm1, 0x8(%rsp) vmovss %xmm0, 0x4(%rsp) callq 0x3ceed vmovss 0x4(%rsp), %xmm0 vmovss 0x8(%rsp), %xmm1 vmovss 0xc(%rsp), %xmm2 movq (%r14), %rdx movq 0x8(%r14), %rcx movq %r15, %rdi movq %rbx, %rsi callq 0x52c46 jmp 0x51cec movq (%r14), %rdi movq 0x8(%r14), %rsi movq %r15, %rdx vmovss %xmm2, 0xc(%rsp) vmovss %xmm1, 0x8(%rsp) vmovss %xmm0, 0x4(%rsp) callq 0x5507f vmovss 0x4(%rsp), %xmm0 vmovss 0x8(%rsp), %xmm1 vmovss 0xc(%rsp), %xmm2 movq (%r14), %rdx movq 0x8(%r14), %rcx movq %r15, %rdi movq %rbx, %rsi callq 0x535f8 movq %r15, %rdi movq %rbx, %rsi movq %r14, %rdx addq $0x20, %rsp popq %rbx popq %r14 popq %r15 jmp 0x526ea movq (%r14), %rdi movq 0x8(%r14), %rsi movq %rcx, %rdx vmovss %xmm2, 0xc(%rsp) vmovss %xmm1, 0x8(%rsp) vmovss %xmm0, 0x4(%rsp) callq 0x3ceed vmovss 0x4(%rsp), %xmm0 vmovss 0x8(%rsp), %xmm1 vmovss 0xc(%rsp), %xmm2 movq (%r14), %rdx movq 0x8(%r14), %rcx movq %r15, %rdi movq %rbx, %rsi callq 0x52c46 movq %r14, %rdi movq %r15, %rsi movq %rbx, %rdx addq $0x20, %rsp popq %rbx popq %r14 popq %r15 jmp 0x53a50 nop
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::itm::best_solution_recorder<baryonyx::itm::default_cost_type<float>, float, baryonyx::itm::minimize_tag>::try_update(baryonyx::itm::local_context&, baryonyx::bit_array const&, double, long)
void try_update(local_context& ctx, const bit_array& solution, const double value, const long int loop) { auto hash = bit_array_hash()(solution); if (m_storage.can_be_inserted(hash, value)) { const auto end = std::chrono::steady_clock::now(); const auto duration = compute_duration(m_start, end); m_storage.insert(ctx, solution, hash, value, duration, loop); } }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x18, %rsp movq %rdi, %r13 leaq 0xf(%rsp), %rdi movq %rsi, %r15 movq %rdx, %rsi movq %rcx, %rbx vmovsd %xmm0, 0x10(%rsp) movq %rdx, %r14 callq 0x3775a vmovsd 0x10(%rsp), %xmm0 leaq 0x8(%r13), %rbp movq %rax, %r12 movq %rax, %rsi movq %rbp, %rdi callq 0x55576 testb %al, %al je 0x51dd9 callq 0xb5a0 subq (%r13), %rax movq %rbp, %rdi movq %r15, %rsi movq %r14, %rdx movq %r12, %rcx movq %rbx, %r8 vcvtsi2sd %rax, %xmm1, %xmm0 vdivsd 0x407cb2(%rip), %xmm0, %xmm1 # 0x459a80 vmovsd 0x10(%rsp), %xmm0 callq 0x555f6 addq $0x18, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq
/quesnel[P]baryonyx/lib/src/itm-optimizer-common.hpp
baryonyx::itm::best_solution_recorder<baryonyx::itm::default_cost_type<float>, float, baryonyx::itm::minimize_tag>::try_advance(baryonyx::itm::local_context&, baryonyx::bit_array const&, int, long)
void try_advance(local_context& ctx, const bit_array& solution, const int remaining_constraints, const long int loop) { auto hash = bit_array_hash()(solution); if (m_storage.can_be_inserted(hash, remaining_constraints)) { const auto end = std::chrono::steady_clock::now(); const auto duration = compute_duration(m_start, end); m_storage.insert( ctx, solution, hash, remaining_constraints, duration, loop); } }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x18, %rsp movq %rdi, %r13 leaq 0xf(%rsp), %rdi movq %rsi, %r15 movq %rdx, %rsi movq %r8, 0x10(%rsp) movl %ecx, %ebp movq %rdx, %r14 callq 0x3775a leaq 0x8(%r13), %rbx movq %rax, %r12 movq %rax, %rsi movl %ebp, %edx movq %rbx, %rdi callq 0x55776 testb %al, %al je 0x51e5a callq 0xb5a0 subq (%r13), %rax movq 0x10(%rsp), %r9 movq %rbx, %rdi movq %r15, %rsi movq %r14, %rdx movq %r12, %rcx movl %ebp, %r8d vcvtsi2sd %rax, %xmm0, %xmm0 vdivsd 0x407c2b(%rip), %xmm0, %xmm0 # 0x459a80 callq 0x557e0 addq $0x18, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq nop
/quesnel[P]baryonyx/lib/src/itm-optimizer-common.hpp
int baryonyx::itm::compute_order::push_and_run<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::minimize_tag, baryonyx::itm::default_cost_type<float>>, baryonyx::bit_array, float>(baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::minimize_tag, baryonyx::itm::default_cost_type<float>>&, baryonyx::bit_array&, std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>&, float, float, float, float)
int push_and_run(Solver& solver, Xtype& x, random_engine& rng, Float kappa, Float delta, Float theta, Float objective_amplifier) { bool pi_changed = 0; int remaining = 0; if (use_cycle) order = next_state(order); switch (order) { case solver_parameters::constraint_order::reversing: solver.push_and_compute_update_row(x, R.crbegin(), R.crend(), kappa, delta, theta, objective_amplifier); return compute_violated_constraints(solver, x, R); case solver_parameters::constraint_order::random_sorting: std::shuffle(R.begin(), R.end(), rng); solver.push_and_compute_update_row( x, R.begin(), R.end(), kappa, delta, theta, objective_amplifier); return compute_violated_constraints(solver, x, R); case solver_parameters::constraint_order::infeasibility_decr: std::sort(m_order.begin(), m_order.end(), [](const auto& lhs, const auto& rhs) { return rhs.second < lhs.second; }); solver.push_and_compute_update_row(x, m_order.cbegin(), m_order.cend(), kappa, delta, theta, objective_amplifier); return infeasibility_local_compute_violated_constraints(solver, x); case solver_parameters::constraint_order::infeasibility_incr: std::sort(m_order.begin(), m_order.end(), [](const auto& lhs, const auto& rhs) { return lhs.second < rhs.second; }); solver.push_and_compute_update_row(x, m_order.cbegin(), m_order.cend(), kappa, delta, theta, objective_amplifier); return infeasibility_local_compute_violated_constraints(solver, x); case solver_parameters::constraint_order::lagrangian_decr: std::sort( R.begin(), R.end(), [&solver](const auto lhs, const auto rhs) { return solver.pi[rhs] < solver.pi[lhs]; }); solver.push_and_compute_update_row(x, R.cbegin(), R.cend(), kappa, delta, theta, objective_amplifier); return compute_violated_constraints(solver, x, R); case solver_parameters::constraint_order::lagrangian_incr: std::sort( R.begin(), R.end(), [&solver](const auto lhs, const auto rhs) { return solver.pi[lhs] < solver.pi[rhs]; }); solver.push_and_compute_update_row(x, R.cbegin(), R.cend(), kappa, delta, theta, objective_amplifier); return compute_violated_constraints(solver, x, R); case solver_parameters::constraint_order::pi_sign_change: std::shuffle(R.begin(), R.end(), rng); pi_changed = solver.push_and_compute_update_row( x, R.begin(), R.end(), kappa, delta, theta, objective_amplifier); remaining = local_compute_violated_constraints(solver, x); if (!pi_changed && remaining == 0) return 0; return remaining; case solver_parameters::constraint_order::none: default: solver.push_and_compute_update_row(x, R.cbegin(), R.cend(), kappa, delta, theta, objective_amplifier); return compute_violated_constraints(solver, x, R); } }
pushq %r15 pushq %r14 pushq %rbx subq $0x20, %rsp movl 0x30(%rdi), %eax cmpb $0x1, 0x34(%rdi) movq %rdx, %rbx movq %rsi, %r15 movq %rdi, %r14 jne 0x51e96 xorl %esi, %esi leal 0x1(%rax), %edx cmpl $0x7, %eax cmovll %edx, %esi movl %esi, %eax movl %esi, 0x30(%r14) decl %eax cmpl $0x6, %eax ja 0x52007 leaq 0x407d0c(%rip), %rdx # 0x459bb4 movslq (%rdx,%rax,4), %rax addq %rdx, %rax jmpq *%rax movq 0x8(%r14), %rax leaq 0x18(%rsp), %rdx leaq 0x10(%rsp), %rcx movq %r15, %rdi movq %rbx, %rsi movq %rax, (%rdx) movq (%r14), %rax movq %rax, (%rcx) callq 0x558e0 movq %r15, %rdi movq %rbx, %rsi movq %r14, %rdx callq 0x526ea addq $0x20, %rsp popq %rbx popq %r14 popq %r15 retq movq (%r14), %rdi movq 0x8(%r14), %rsi movq %r15, %rdx vmovss %xmm2, 0xc(%rsp) vmovss %xmm1, 0x8(%rsp) vmovss %xmm0, 0x4(%rsp) callq 0x561da jmp 0x51ff5 movq 0x18(%r14), %rdi movq 0x20(%r14), %rsi vmovss %xmm2, 0xc(%rsp) vmovss %xmm1, 0x8(%rsp) vmovss %xmm0, 0x4(%rsp) callq 0x55904 jmp 0x51f51 movq 0x18(%r14), %rdi movq 0x20(%r14), %rsi vmovss %xmm2, 0xc(%rsp) vmovss %xmm1, 0x8(%rsp) vmovss %xmm0, 0x4(%rsp) callq 0x55d6f vmovss 0x4(%rsp), %xmm0 vmovss 0x8(%rsp), %xmm1 vmovss 0xc(%rsp), %xmm2 movq 0x18(%r14), %rdx movq 0x20(%r14), %rcx movq %r15, %rdi movq %rbx, %rsi callq 0x5309e movq %r14, %rdi movq %r15, %rsi movq %rbx, %rdx addq $0x20, %rsp popq %rbx popq %r14 popq %r15 jmp 0x534f6 movq (%r14), %rdi movq 0x8(%r14), %rsi movq %rcx, %rdx vmovss %xmm2, 0xc(%rsp) vmovss %xmm1, 0x8(%rsp) vmovss %xmm0, 0x4(%rsp) callq 0x3ceed vmovss 0x4(%rsp), %xmm0 vmovss 0x8(%rsp), %xmm1 vmovss 0xc(%rsp), %xmm2 movq (%r14), %rdx movq 0x8(%r14), %rcx movq %r15, %rdi movq %rbx, %rsi callq 0x52c46 jmp 0x52019 movq (%r14), %rdi movq 0x8(%r14), %rsi movq %r15, %rdx vmovss %xmm2, 0xc(%rsp) vmovss %xmm1, 0x8(%rsp) vmovss %xmm0, 0x4(%rsp) callq 0x566cc vmovss 0x4(%rsp), %xmm0 vmovss 0x8(%rsp), %xmm1 vmovss 0xc(%rsp), %xmm2 movq (%r14), %rdx movq 0x8(%r14), %rcx movq %r15, %rdi movq %rbx, %rsi callq 0x535f8 movq %r15, %rdi movq %rbx, %rsi movq %r14, %rdx addq $0x20, %rsp popq %rbx popq %r14 popq %r15 jmp 0x526ea movq (%r14), %rdi movq 0x8(%r14), %rsi movq %rcx, %rdx vmovss %xmm2, 0xc(%rsp) vmovss %xmm1, 0x8(%rsp) vmovss %xmm0, 0x4(%rsp) callq 0x3ceed vmovss 0x4(%rsp), %xmm0 vmovss 0x8(%rsp), %xmm1 vmovss 0xc(%rsp), %xmm2 movq (%r14), %rdx movq 0x8(%r14), %rcx movq %r15, %rdi movq %rbx, %rsi callq 0x52c46 movq %r14, %rdi movq %r15, %rsi movq %rbx, %rdx addq $0x20, %rsp popq %rbx popq %r14 popq %r15 jmp 0x53a50
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::itm::best_solution_recorder<baryonyx::itm::default_cost_type<float>, float, baryonyx::itm::minimize_tag>::mutation(baryonyx::itm::local_context&, baryonyx::bit_array&)
void mutation(local_context& ctx, bit_array& x) { if (ctx.value_p_dist.mean() == 0.0 && ctx.value_p_dist.stddev() == 0.0) return; double val_p, var_p; do var_p = ctx.variable_p_dist(ctx.rng); while (var_p <= 0.0 || var_p >= 1.0); do val_p = ctx.value_p_dist(ctx.rng); while (val_p < 0.0 || val_p > 1.0); to_log(stdout, 7u, "- mutation variables {}% with " " {}% of set\n", var_p, val_p); std::bernoulli_distribution dist_var_p(var_p); std::bernoulli_distribution dist_value_p(val_p); for (int i = 0, e = x.size(); i != e; ++i) { if (dist_var_p(ctx.rng)) { to_log(stdout, 9u, "- mutate variable {}\n", i); x.set(i, dist_value_p(ctx.rng)); } } }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x28, %rsp vmovsd 0x48(%rsi), %xmm0 vxorpd %xmm1, %xmm1, %xmm1 movq %rdx, %rbx movq %rsi, %r14 vucomisd %xmm1, %xmm0 jne 0x521d6 jp 0x521d6 vmovsd 0x50(%r14), %xmm0 vucomisd %xmm1, %xmm0 jne 0x521d6 jp 0x521d6 addq $0x28, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq leaq 0x48(%r14), %r15 leaq 0x28(%r14), %r12 movq %r12, %rdi movq %r14, %rsi callq 0x3c480 vxorpd %xmm1, %xmm1, %xmm1 vucomisd %xmm0, %xmm1 jae 0x521de vucomisd 0x401e3d(%rip), %xmm0 # 0x454038 jae 0x521de vmovsd %xmm0, 0x18(%rsp) movq %r15, %rdi movq %r14, %rsi callq 0x3c480 vxorpd %xmm1, %xmm1, %xmm1 vucomisd %xmm0, %xmm1 ja 0x52203 vucomisd 0x401e18(%rip), %xmm0 # 0x454038 ja 0x52203 movq 0x5ead9f(%rip), %rax # 0x63cfc8 leaq 0x20(%rsp), %r15 leaq 0x4081e7(%rip), %rcx # 0x45a41c vmovsd %xmm0, (%r15) movq (%rax), %rdi pushq $0x7 popq %rsi pushq $0x2a popq %rdx leaq 0x18(%rsp), %r12 movq %r15, %r9 movq %r12, %r8 callq 0x3c5d8 vmovsd (%r12), %xmm0 vmovsd (%r15), %xmm1 leaq 0x4(%rsp), %rax andl $0x0, (%rax) xorl %eax, %eax movl (%rbx), %r15d vmovsd %xmm0, 0x10(%rsp) vmovsd %xmm1, 0x8(%rsp) pushq $0x9 popq %rbp pushq $0x15 popq %r13 cmpl %r15d, %eax je 0x521c7 movq %r14, %rdi callq 0x36ac3 vmovsd 0x10(%rsp), %xmm1 vucomisd %xmm0, %xmm1 jbe 0x522e2 movq 0x5ead26(%rip), %rax # 0x63cfc8 leaq 0x40819e(%rip), %rcx # 0x45a447 leaq 0x4(%rsp), %r8 movl %ebp, %esi movq %r13, %rdx movq (%rax), %rdi callq 0x3c631 movl 0x4(%rsp), %r12d movq %r14, %rdi callq 0x36ac3 vmovsd 0x8(%rsp), %xmm1 xorl %edx, %edx movq %rbx, %rdi movl %r12d, %esi vucomisd %xmm0, %xmm1 seta %dl callq 0x3c67e movl 0x4(%rsp), %eax incl %eax movl %eax, 0x4(%rsp) jmp 0x5227e
/quesnel[P]baryonyx/lib/src/itm-optimizer-common.hpp
baryonyx::itm::storage<baryonyx::itm::default_cost_type<float>, baryonyx::itm::minimize_tag>::crossover(baryonyx::itm::local_context&, baryonyx::bit_array&)
void crossover(local_context& ctx, bit_array& x) { m_indices_reader lock(m_indices_mutex); if (ctx.crossover_bastert_insertion(ctx.rng)) { int first = m_indices[choose_a_solution(ctx)]; std::bernoulli_distribution b(0.5); if (b(ctx.rng)) { if (b(ctx.rng)) { crossover(ctx, x, m_data[first].x, m_bastert); to_log(stdout, 7u, "- crossover between {} ({}) and bastert\n", first, m_data[first].value); } else { m_data[first].x = m_bastert; } } else { init_with_random(m_random, ctx.rng, x.size(), 0.5); if (b(ctx.rng)) { crossover(ctx, x, m_data[first].x, m_random); to_log(stdout, 7u, "- crossover between {} ({}) and random\n", first, m_data[first].value); } else { m_data[first].x = m_random; } } } else { int first = m_indices[choose_a_solution(ctx)]; int second = m_indices[choose_a_solution(ctx)]; while (first == second) second = m_indices[choose_a_solution(ctx)]; crossover(ctx, x, m_data[first].x, m_data[second].x); to_log(stdout, 7u, "- crossover between {} ({}) and {} ({})\n", first, m_data[first].value, second, m_data[second].value); } }
pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x20, %rsp movq %rdi, 0x10(%rsp) movq %rdx, %r14 movq %rsi, %r15 movq %rdi, %rbx movb $0x1, 0x18(%rsp) callq 0x3c460 leaq 0x80(%r15), %rdi movq %r15, %rsi callq 0x36254 testb %al, %al je 0x523a3 movq %rbx, %rdi movq %r15, %rsi callq 0x52522 movq 0x38(%rbx), %rcx cltq movl (%rcx,%rax,4), %eax movl %eax, 0x8(%rsp) movq %r15, %rdi callq 0x36ac3 vmovsd 0x40662a(%rip), %xmm1 # 0x458978 vucomisd %xmm0, %xmm1 jbe 0x52447 movq %r15, %rdi callq 0x36ac3 vmovsd 0x406610(%rip), %xmm1 # 0x458978 vucomisd %xmm0, %xmm1 jbe 0x524cb movslq 0x8(%rsp), %rax leaq 0x68(%rbx), %r8 imulq $0x38, %rax, %rcx addq 0x50(%rbx), %rcx movq %rbx, %rdi movq %r15, %rsi movq %r14, %rdx callq 0x52566 addq $0x50, %rbx leaq 0x408006(%rip), %rcx # 0x45a3a2 pushq $0x28 jmp 0x524a2 movq %rbx, %rdi movq %r15, %rsi callq 0x52522 movq 0x38(%rbx), %rcx cltq movslq (%rcx,%rax,4), %r12 movl %r12d, 0x8(%rsp) movq %rbx, %rdi movq %r15, %rsi callq 0x52522 movq 0x38(%rbx), %rcx cltq movslq (%rcx,%rax,4), %rax movl %eax, 0xc(%rsp) cmpl %eax, %r12d jne 0x523e8 movq %rbx, %rdi movq %r15, %rsi callq 0x52522 jmp 0x523c8 movq 0x50(%rbx), %r8 imulq $0x38, %r12, %r12 imulq $0x38, %rax, %r13 leaq (%r8,%r12), %rcx addq %r13, %r8 movq %rbx, %rdi movq %r15, %rsi movq %r14, %rdx callq 0x52566 movq 0x5eabb8(%rip), %rax # 0x63cfc8 movq 0x50(%rbx), %rdx movq (%rax), %rdi leaq 0x10(%rdx,%r13), %rax leaq 0x10(%rdx,%r12), %r9 leaq 0xc(%rsp), %r10 leaq 0x407fc6(%rip), %rcx # 0x45a3f3 pushq $0x7 popq %rsi pushq $0x28 popq %rdx leaq 0x8(%rsp), %r8 pushq %rax pushq %r10 callq 0x3c3e1 popq %rax popq %rcx jmp 0x524ea movl (%r14), %edx leaq 0x78(%rbx), %r12 vmovsd 0x406522(%rip), %xmm0 # 0x458978 movq %r12, %rdi movq %r15, %rsi callq 0x362ac movq %r15, %rdi callq 0x36ac3 vmovsd 0x406507(%rip), %xmm1 # 0x458978 movslq 0x8(%rsp), %rax imulq $0x38, %rax, %rcx addq 0x50(%rbx), %rcx vucomisd %xmm0, %xmm1 jbe 0x524df movq %rbx, %rdi movq %r15, %rsi movq %r14, %rdx movq %r12, %r8 callq 0x52566 addq $0x50, %rbx leaq 0x407f2b(%rip), %rcx # 0x45a3cb pushq $0x27 popq %rdx movq 0x5eab1e(%rip), %rax # 0x63cfc8 leaq 0x8(%rsp), %r8 movq (%rbx), %rsi movslq (%r8), %r9 movq (%rax), %rdi imulq $0x38, %r9, %rax leaq 0x10(%rsi,%rax), %r9 pushq $0x7 popq %rsi callq 0x3c388 jmp 0x524ea movslq 0x8(%rsp), %rax imulq $0x38, %rax, %rcx addq 0x50(%rbx), %rcx addq $0x68, %rbx movq %rbx, %r12 movq %rcx, %rdi movq %r12, %rsi callq 0x36a44 leaq 0x10(%rsp), %rdi callq 0x3c450 addq $0x20, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 retq jmp 0x5250c jmp 0x5250c jmp 0x5250c jmp 0x5250c jmp 0x5250c movq %rax, %rbx leaq 0x10(%rsp), %rdi callq 0x3c450 movq %rbx, %rdi callq 0xb3d0 nop
/quesnel[P]baryonyx/lib/src/itm-optimizer-common.hpp
baryonyx::itm::storage<baryonyx::itm::default_cost_type<float>, baryonyx::itm::minimize_tag>::crossover(baryonyx::itm::local_context&, baryonyx::bit_array&, baryonyx::bit_array const&, baryonyx::bit_array const&)
void crossover(local_context& ctx, bit_array& x, const bit_array& first, const bit_array& second) { const auto block_size = x.block_size(); for (int i = 0; i != block_size; ++i) { const auto x1 = first.block(i); const auto x2 = second.block(i); x.set_block(i, ((x1 ^ x2) & ctx.crossover_dist(ctx.rng)) ^ x1); } }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x18, %rsp movl 0x4(%rdx), %r15d leaq 0x70(%rsi), %r13 movq %r8, 0x10(%rsp) movq %rcx, 0x8(%rsp) movq %rsi, %r12 xorl %ebp, %ebp movq %rdx, (%rsp) cmpq %rbp, %r15 je 0x525d9 movq 0x8(%rsp), %rdi movl %ebp, %esi callq 0x377b0 movq 0x10(%rsp), %rdi movl %ebp, %esi movq %rax, %rbx callq 0x377b0 movq %rax, %r14 movq %r13, %rdi movq %r12, %rsi callq 0x3709a andnq %rbx, %rax, %rcx andq %rax, %r14 orq %rcx, %r14 movq (%rsp), %rcx movq 0x8(%rcx), %rax movq %r14, (%rax,%rbp,8) incq %rbp jmp 0x5258f addq $0x18, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq
/quesnel[P]baryonyx/lib/src/itm-optimizer-common.hpp
int baryonyx::itm::compute_order::infeasibility_local_compute_violated_constraints<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::minimize_tag, baryonyx::itm::default_cost_type<float>> const, baryonyx::bit_array>(baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::minimize_tag, baryonyx::itm::default_cost_type<float>> const&, baryonyx::bit_array const&)
int infeasibility_local_compute_violated_constraints(Solver& solver, const Xtype& x) { m_order.clear(); for (int k = 0, e = solver.m; k != e; ++k) { sparse_matrix<int>::const_row_iterator it, et; std::tie(it, et) = solver.ap.row(k); int v = 0; for (; it != et; ++it) v += solver.factor(it->value) * x[it->column]; if (solver.bound_min(k) > v) m_order.push_back(std::make_pair(k, solver.bound_min(k) - v)); else if (solver.bound_max(k) < v) m_order.push_back(std::make_pair(k, v - solver.bound_max(k))); } return length(m_order); }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x38, %rsp movq 0x18(%rdi), %rax movq %rdx, %r14 movq %rsi, %r15 cmpq %rax, 0x20(%rdi) je 0x5260a movq %rax, 0x20(%rdi) leaq 0x18(%rdi), %rax leaq 0x8(%r15), %rcx xorl %r12d, %r12d movq %rdi, 0x20(%rsp) movq %rax, 0x10(%rsp) movl 0x80(%r15), %eax movq %rcx, 0x18(%rsp) movq %rax, 0x28(%rsp) cmpq 0x28(%rsp), %r12 je 0x526cf movq 0x18(%rsp), %rsi movq %rsp, %rdi movl %r12d, %edx movq %r12, 0x30(%rsp) callq 0x3c868 movq (%rsp), %r13 movq 0x8(%rsp), %r12 xorl %ebx, %ebx cmpq %r13, %r12 je 0x52683 movslq (%r12), %rax movq 0x48(%r15), %rcx movl 0x4(%r12), %esi movq %r14, %rdi movl (%rcx,%rax,4), %ebp callq 0x3664a imull %ebp, %eax addq $0x8, %r12 addl %eax, %ebx jmp 0x5265b movq 0x30(%rsp), %r12 movq 0x58(%r15), %rcx imulq $0xc, %r12, %rdx movl (%rcx,%rdx), %eax subl %ebx, %eax jle 0x526a4 shlq $0x20, %rax orq %r12, %rax movq %rax, (%rsp) jmp 0x526b5 subl 0x4(%rcx,%rdx), %ebx jle 0x526c2 shlq $0x20, %rbx orq %r12, %rbx movq %rbx, (%rsp) movq 0x10(%rsp), %rdi movq %rsp, %rsi callq 0x3c8c2 movq 0x20(%rsp), %rdi incq %r12 jmp 0x52630 movq 0x20(%rdi), %rax subq 0x18(%rdi), %rax shrq $0x3, %rax addq $0x38, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq
/quesnel[P]baryonyx/lib/src/itm-common.hpp
int baryonyx::itm::compute_violated_constraints<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::minimize_tag, baryonyx::itm::default_cost_type<float>>, baryonyx::bit_array>(baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::minimize_tag, baryonyx::itm::default_cost_type<float>> const&, baryonyx::bit_array const&, std::vector<int, std::allocator<int>>&)
int compute_violated_constraints(const Solver& slv, const Xtype& x, std::vector<int>& out) { out.clear(); for (int k = 0; k != slv.m; ++k) if (!is_valid_constraint(slv, k, x)) out.emplace_back(k); return length(out); }
pushq %r15 pushq %r14 pushq %r12 pushq %rbx pushq %rax movq (%rdx), %rax movq %rdx, %rbx movq %rsi, %r14 movq %rdi, %r15 cmpq %rax, 0x8(%rdx) je 0x52708 movq %rax, 0x8(%rbx) leaq 0x4(%rsp), %r12 xorl %esi, %esi movl %esi, 0x4(%rsp) cmpl 0x80(%r15), %esi je 0x5273e movq %r15, %rdi movq %r14, %rdx callq 0x52755 testb %al, %al jne 0x52736 movq %rbx, %rdi movq %r12, %rsi callq 0x31460 movl 0x4(%rsp), %esi incl %esi jmp 0x5270f movq 0x8(%rbx), %rax subq (%rbx), %rax shrq $0x2, %rax addq $0x8, %rsp popq %rbx popq %r12 popq %r14 popq %r15 retq
/quesnel[P]baryonyx/lib/src/itm-common.hpp
bool baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::minimize_tag, baryonyx::itm::default_cost_type<float>>::compute_update_row<baryonyx::bit_array, std::reverse_iterator<__gnu_cxx::__normal_iterator<int const*, std::vector<int, std::allocator<int>>>>>(baryonyx::bit_array&, std::reverse_iterator<__gnu_cxx::__normal_iterator<int const*, std::vector<int, std::allocator<int>>>>, std::reverse_iterator<__gnu_cxx::__normal_iterator<int const*, std::vector<int, std::allocator<int>>>>, float, float, float)
bool compute_update_row(Xtype& x, Iterator first, Iterator last, Float kappa, Float delta, Float theta) { for (; first != last; ++first) { auto k = constraint(first); bx_expects(k < m); auto [row_begin, row_end] = ap.row(k); decrease_preference(row_begin, row_end, theta); int r_size = 0; for (auto it = row_begin; it != row_end; ++it, ++r_size) { Float sum_a_p = 0; auto [col_begin, col_end] = ap.column(it->column); for (; col_begin != col_end; ++col_begin) sum_a_p += static_cast<Float>(A[col_begin->value]) * P[col_begin->value]; R[r_size].id = r_size; R[r_size].a = A[it->value]; R[r_size].value = c(row_begin->column, x) - sum_a_p; } calculator_sort<Mode>(R.get(), R.get() + r_size, rng); int value = 0; bool valid = b[k].min <= 0; int i = -1; // if (!valid) { // do { // ++i; // value += R[i].a; // valid = b[k].min <= value; // } while (!valid && i + 1 < r_size); // } // valid = b[k].min <= value && value <= b[k].max; // while (i + 1 < r_size && valid) { // ++i; // value += R[i].a; // valid = b[k].min <= value && value <= b[k].max; // } // std::uniform_real_distribution<Float> real_dist(Float{ 0 }, // Float{ 1 }); // auto selected = i; // auto d = delta; // if (selected < 0) { // d += (kappa / (one - kappa)) * (R[0].value / two); // d *= real_dist(rng); // for (i = 0; i != r_size; ++i) { // auto var = row_begin + R[i].id; // if (R[i].is_negative()) { // x.set(var->column, 1); // P[var->value] += d; // } else { // x.set(var->column, 0); // P[var->value] -= d; // } // } // } else if (selected + 1 >= r_size) { // d += (kappa / (one - kappa)) * (R[selected].value * middle); // d *= real_dist(rng); // for (i = 0; i != r_size; ++i) { // auto var = row_begin + R[i].id; // if (R[i].is_negative()) { // x.set(var->column, 0); // P[var->value] -= d; // } else { // x.set(var->column, 1); // P[var->value] += d; // } // } // } else { // d += (kappa / (one - kappa)) * // (R[selected + 1].value - R[selected].value); // d *= real_dist(rng); // for (i = 0; i <= selected; ++i) { // auto var = row_begin + R[i].id; // if (R[i].is_negative()) { // x.set(var->column, 0); // P[var->value] -= d; // } else { // x.set(var->column, 1); // P[var->value] += d; // } // } // for (; i != r_size; ++i) { // auto var = row_begin + R[i].id; // if (R[i].is_negative()) { // x.set(var->column, 1); // P[var->value] += d; // } else { // x.set(var->column, 0); // P[var->value] -= d; // } // } constexpr Float one{ 1 }; constexpr Float two{ 2 }; if (!valid) { do { ++i; value += R[i].a; valid = b[k].min <= value; auto var = row_begin + R[i].id; x.set(var->column); P[var->value] += delta + (kappa / (one - kappa)) * (R[i].value / two); } while (!valid && i + 1 < r_size); } valid = b[k].min <= value && value <= b[k].max; while (i + 1 < r_size && valid) { ++i; value += R[i].a; valid = b[k].min <= value && value <= b[k].max; auto var = row_begin + R[i].id; if (valid) valid = stop_iterating<Mode>(R[i].value, rng); if (valid) { x.set(var->column); P[var->value] += delta + (kappa / (one - kappa)) * (R[i].value / two); } else { x.unset(var->column); P[var->value] -= delta + (kappa / (one - kappa)) * (R[i].value / two); } } while (i + 1 < r_size) { ++i; auto var = row_begin + R[i].id; x.unset(var->column); P[var->value] -= delta + (kappa / (one - kappa)) * (R[i].value / two); } bx_expects(is_valid_constraint(*this, k, x)); } return false; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x88, %rsp vmovss %xmm1, 0xc(%rsp) vmovss 0x4072c5(%rip), %xmm1 # 0x459ac4 movq (%rdx), %rax leaq 0x8(%rdi), %r14 leaq 0x50(%rsp), %r15 movq %rdi, %r12 vmovss %xmm2, 0x3c(%rsp) movq %rcx, 0x70(%rsp) movq %rsi, 0x10(%rsp) movq %rdx, 0x68(%rsp) movq %rdi, 0x18(%rsp) movq %r14, 0x60(%rsp) vsubss %xmm0, %xmm1, %xmm1 vdivss %xmm1, %xmm0, %xmm0 vmovss %xmm0, 0x8(%rsp) movq 0x70(%rsp), %rcx cmpq (%rcx), %rax je 0x52bef movslq -0x4(%rax), %r13 cmpl 0x80(%r12), %r13d jge 0x52c03 leaq 0x28(%rsp), %rdi movq %r14, %rsi movl %r13d, %edx callq 0x3de66 vmovss 0x3c(%rsp), %xmm0 movq 0x28(%rsp), %rdx movq 0x30(%rsp), %rsi movq %r12, %rdi callq 0x53a92 movq 0x30(%rsp), %rbx xorl %ebp, %ebp cmpq 0x28(%rsp), %rbx je 0x5291c movl 0x4(%rbx), %edx movq %r15, %rdi movq %r14, %rsi callq 0x3dede movq 0x50(%rsp), %rcx movq 0x58(%rsp), %rdx movq 0x48(%r12), %rax movq 0x68(%r12), %rsi vxorps %xmm0, %xmm0, %xmm0 cmpq %rcx, %rdx je 0x528d9 movslq (%rdx), %rdi addq $0x8, %rdx vcvtsi2ssl (%rax,%rdi,4), %xmm3, %xmm1 vfmadd231ss (%rsi,%rdi,4), %xmm1, %xmm0 # xmm0 = (xmm1 * mem) + xmm0 movq %rdx, 0x58(%rsp) jmp 0x528bb movq 0x50(%r12), %rcx imulq $0xc, %rbp, %rdx movl %ebp, 0x4(%rcx,%rdx) incq %rbp movslq (%rbx), %rsi addq $0x8, %rbx movl (%rax,%rsi,4), %eax movl %eax, 0x8(%rcx,%rdx) movq 0x70(%r12), %rax movq 0x30(%rsp), %rsi movslq 0x4(%rsi), %rsi movq 0x8(%rax), %rax vmovss (%rax,%rsi,4), %xmm1 vsubss %xmm0, %xmm1, %xmm0 vmovss %xmm0, (%rcx,%rdx) jmp 0x5288a movq 0x50(%r12), %rdi movq (%r12), %rdx movl %ebp, %eax imulq $0xc, %rax, %rsi addq %rdi, %rsi callq 0x53aaf movq 0x58(%r12), %rax imulq $0xc, %r13, %rdx movq %r13, 0x40(%rsp) movq %rbp, 0x78(%rsp) movq %rdx, 0x48(%rsp) cmpl $0x0, (%rax,%rdx) jle 0x52a23 leal -0x2(%rbp), %eax movabsq $-0x100000000, %r14 # imm = 0xFFFFFFFF00000000 xorl %r15d, %r15d cltq movq %rax, 0x80(%rsp) movq 0x50(%r12), %rax pushq $-0x1 popq %rbx xorl %ebp, %ebp movabsq $0x100000000, %rcx # imm = 0x100000000 movq 0x30(%rsp), %r13 movq 0x10(%rsp), %rdi addl 0x8(%rax,%r15), %ebp addq %rcx, %r14 movq 0x58(%r12), %rcx movslq 0x4(%rax,%r15), %r12 movl (%rcx,%rdx), %ecx movl 0x4(%r13,%r12,8), %esi movl %ecx, 0x20(%rsp) callq 0x369c8 movq 0x18(%rsp), %rax movslq (%r13,%r12,8), %rcx movq 0x18(%rsp), %r12 vmovss 0x407109(%rip), %xmm0 # 0x459ad0 vmovss 0x8(%rsp), %xmm1 movq 0x50(%rax), %rax movq 0x68(%r12), %rdx vmulss (%rax,%r15), %xmm0, %xmm0 vfmadd213ss 0xc(%rsp), %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + mem vaddss (%rdx,%rcx,4), %xmm0, %xmm0 vmovss %xmm0, (%rdx,%rcx,4) movq 0x48(%rsp), %rdx cmpl %ebp, 0x20(%rsp) jle 0x52a11 addq $0xc, %r15 leaq 0x1(%rbx), %rcx cmpq 0x80(%rsp), %rbx movq %rcx, %rbx jl 0x52979 movq 0x58(%r12), %rax sarq $0x20, %r14 cmpl %ebp, (%rax,%rdx) jle 0x52a29 xorl %eax, %eax jmp 0x52a30 xorl %ebp, %ebp pushq $-0x1 popq %r14 cmpl 0x4(%rax,%rdx), %ebp setle %al movslq 0x78(%rsp), %rcx imulq $0xc, %r14, %r15 leaq 0x1(%r14), %rbx movq %rcx, 0x20(%rsp) incq %r14 cmpq 0x20(%rsp), %r14 jae 0x52b45 testb $0x1, %al je 0x52b45 movq 0x50(%r12), %rax movq 0x58(%r12), %rcx addl 0x14(%rax,%r15), %ebp cmpl %ebp, (%rcx,%rdx) jle 0x52a7c movslq 0x10(%rax,%r15), %r13 shlq $0x3, %r13 addq 0x30(%rsp), %r13 jmp 0x52aec movslq 0x10(%rax,%r15), %r13 addq %rdx, %rcx shlq $0x3, %r13 addq 0x30(%rsp), %r13 cmpl 0x4(%rcx), %ebp jg 0x52aec vmovss 0xc(%rax,%r15), %xmm0 movq (%r12), %rdi callq 0x53ae2 testb %al, %al je 0x52aec movl 0x4(%r13), %esi movq 0x10(%rsp), %rdi callq 0x369c8 movq 0x50(%r12), %rax vmovss 0x40700f(%rip), %xmm0 # 0x459ad0 movq 0x68(%r12), %rcx vmovss 0x8(%rsp), %xmm1 vmulss 0xc(%rax,%r15), %xmm0, %xmm0 movslq (%r13), %rax vfmadd213ss 0xc(%rsp), %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + mem vaddss (%rcx,%rax,4), %xmm0, %xmm0 vmovss %xmm0, (%rcx,%rax,4) movb $0x1, %al jmp 0x52b34 movl 0x4(%r13), %esi movq 0x10(%rsp), %rdi callq 0x36a06 movq 0x50(%r12), %rax vmovss 0x406fc9(%rip), %xmm0 # 0x459ad0 movq 0x68(%r12), %rcx vmovss 0x8(%rsp), %xmm1 vmulss 0xc(%rax,%r15), %xmm0, %xmm0 movslq (%r13), %rax vfmadd213ss 0xc(%rsp), %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + mem vmovss (%rcx,%rax,4), %xmm1 vsubss %xmm0, %xmm1, %xmm0 vmovss %xmm0, (%rcx,%rax,4) xorl %eax, %eax movq 0x48(%rsp), %rdx addq $0xc, %r15 incq %rbx jmp 0x52a42 movq 0x40(%rsp), %r13 cmpq 0x20(%rsp), %rbx jae 0x52bbd movq 0x50(%r12), %rax movq 0x30(%rsp), %r14 movq 0x10(%rsp), %rdi movslq 0x10(%rax,%r15), %r12 movl 0x4(%r14,%r12,8), %esi callq 0x36a06 movq 0x18(%rsp), %rax movq 0x18(%rsp), %rcx vmovss 0x406f4f(%rip), %xmm0 # 0x459ad0 vmovss 0x8(%rsp), %xmm1 incq %rbx movq 0x50(%rax), %rax movq 0x68(%rcx), %rcx vmulss 0xc(%rax,%r15), %xmm0, %xmm0 movslq (%r14,%r12,8), %rax movq 0x18(%rsp), %r12 addq $0xc, %r15 vfmadd213ss 0xc(%rsp), %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + mem vmovss (%rcx,%rax,4), %xmm1 vsubss %xmm0, %xmm1, %xmm0 vmovss %xmm0, (%rcx,%rax,4) jmp 0x52b4a movq 0x10(%rsp), %rdx movq %r12, %rdi movl %r13d, %esi callq 0x52755 testb %al, %al je 0x52c24 movq 0x68(%rsp), %rcx movq 0x60(%rsp), %r14 leaq 0x50(%rsp), %r15 movq (%rcx), %rax addq $-0x4, %rax movq %rax, (%rcx) jmp 0x5283b xorl %eax, %eax addq $0x88, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq leaq 0x4055d4(%rip), %rdi # 0x4581de leaq 0x407869(%rip), %rsi # 0x45a47a leaq 0x40762f(%rip), %rdx # 0x45a247 leaq 0x407861(%rip), %rcx # 0x45a480 callq 0x2813f leaq 0x4055b3(%rip), %rdi # 0x4581de leaq 0x407852(%rip), %rsi # 0x45a484 leaq 0x40760e(%rip), %rdx # 0x45a247 leaq 0x407865(%rip), %rcx # 0x45a4a5 callq 0x2813f nop
/quesnel[P]baryonyx/lib/src/random-solver.cpp
int baryonyx::itm::compute_order::infeasibility_local_compute_violated_constraints<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::minimize_tag, baryonyx::itm::default_cost_type<float>>, baryonyx::bit_array>(baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::minimize_tag, baryonyx::itm::default_cost_type<float>>&, baryonyx::bit_array const&)
int infeasibility_local_compute_violated_constraints(Solver& solver, const Xtype& x) { m_order.clear(); for (int k = 0, e = solver.m; k != e; ++k) { sparse_matrix<int>::const_row_iterator it, et; std::tie(it, et) = solver.ap.row(k); int v = 0; for (; it != et; ++it) v += solver.factor(it->value) * x[it->column]; if (solver.bound_min(k) > v) m_order.push_back(std::make_pair(k, solver.bound_min(k) - v)); else if (solver.bound_max(k) < v) m_order.push_back(std::make_pair(k, v - solver.bound_max(k))); } return length(m_order); }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x38, %rsp movq 0x18(%rdi), %rax movq %rdx, %r14 movq %rsi, %r15 cmpq %rax, 0x20(%rdi) je 0x53518 movq %rax, 0x20(%rdi) leaq 0x18(%rdi), %rax leaq 0x8(%r15), %rcx xorl %r12d, %r12d movq %rdi, 0x20(%rsp) movq %rax, 0x10(%rsp) movl 0x80(%r15), %eax movq %rcx, 0x18(%rsp) movq %rax, 0x28(%rsp) cmpq 0x28(%rsp), %r12 je 0x535dd movq 0x18(%rsp), %rsi movq %rsp, %rdi movl %r12d, %edx movq %r12, 0x30(%rsp) callq 0x3de66 movq (%rsp), %r13 movq 0x8(%rsp), %r12 xorl %ebx, %ebx cmpq %r13, %r12 je 0x53591 movslq (%r12), %rax movq 0x48(%r15), %rcx movl 0x4(%r12), %esi movq %r14, %rdi movl (%rcx,%rax,4), %ebp callq 0x3664a imull %ebp, %eax addq $0x8, %r12 addl %eax, %ebx jmp 0x53569 movq 0x30(%rsp), %r12 movq 0x58(%r15), %rcx imulq $0xc, %r12, %rdx movl (%rcx,%rdx), %eax subl %ebx, %eax jle 0x535b2 shlq $0x20, %rax orq %r12, %rax movq %rax, (%rsp) jmp 0x535c3 subl 0x4(%rcx,%rdx), %ebx jle 0x535d0 shlq $0x20, %rbx orq %r12, %rbx movq %rbx, (%rsp) movq 0x10(%rsp), %rdi movq %rsp, %rsi callq 0x3c8c2 movq 0x20(%rsp), %rdi incq %r12 jmp 0x5353e movq 0x20(%rdi), %rax subq 0x18(%rdi), %rax shrq $0x3, %rax addq $0x38, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq
/quesnel[P]baryonyx/lib/src/itm-common.hpp
bool baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::minimize_tag, baryonyx::itm::default_cost_type<float>>::compute_update_row<baryonyx::bit_array, __gnu_cxx::__normal_iterator<int const*, std::vector<int, std::allocator<int>>>>(baryonyx::bit_array&, __gnu_cxx::__normal_iterator<int const*, std::vector<int, std::allocator<int>>>, __gnu_cxx::__normal_iterator<int const*, std::vector<int, std::allocator<int>>>, float, float, float)
bool compute_update_row(Xtype& x, Iterator first, Iterator last, Float kappa, Float delta, Float theta) { for (; first != last; ++first) { auto k = constraint(first); bx_expects(k < m); auto [row_begin, row_end] = ap.row(k); decrease_preference(row_begin, row_end, theta); int r_size = 0; for (auto it = row_begin; it != row_end; ++it, ++r_size) { Float sum_a_p = 0; auto [col_begin, col_end] = ap.column(it->column); for (; col_begin != col_end; ++col_begin) sum_a_p += static_cast<Float>(A[col_begin->value]) * P[col_begin->value]; R[r_size].id = r_size; R[r_size].a = A[it->value]; R[r_size].value = c(row_begin->column, x) - sum_a_p; } calculator_sort<Mode>(R.get(), R.get() + r_size, rng); int value = 0; bool valid = b[k].min <= 0; int i = -1; // if (!valid) { // do { // ++i; // value += R[i].a; // valid = b[k].min <= value; // } while (!valid && i + 1 < r_size); // } // valid = b[k].min <= value && value <= b[k].max; // while (i + 1 < r_size && valid) { // ++i; // value += R[i].a; // valid = b[k].min <= value && value <= b[k].max; // } // std::uniform_real_distribution<Float> real_dist(Float{ 0 }, // Float{ 1 }); // auto selected = i; // auto d = delta; // if (selected < 0) { // d += (kappa / (one - kappa)) * (R[0].value / two); // d *= real_dist(rng); // for (i = 0; i != r_size; ++i) { // auto var = row_begin + R[i].id; // if (R[i].is_negative()) { // x.set(var->column, 1); // P[var->value] += d; // } else { // x.set(var->column, 0); // P[var->value] -= d; // } // } // } else if (selected + 1 >= r_size) { // d += (kappa / (one - kappa)) * (R[selected].value * middle); // d *= real_dist(rng); // for (i = 0; i != r_size; ++i) { // auto var = row_begin + R[i].id; // if (R[i].is_negative()) { // x.set(var->column, 0); // P[var->value] -= d; // } else { // x.set(var->column, 1); // P[var->value] += d; // } // } // } else { // d += (kappa / (one - kappa)) * // (R[selected + 1].value - R[selected].value); // d *= real_dist(rng); // for (i = 0; i <= selected; ++i) { // auto var = row_begin + R[i].id; // if (R[i].is_negative()) { // x.set(var->column, 0); // P[var->value] -= d; // } else { // x.set(var->column, 1); // P[var->value] += d; // } // } // for (; i != r_size; ++i) { // auto var = row_begin + R[i].id; // if (R[i].is_negative()) { // x.set(var->column, 1); // P[var->value] += d; // } else { // x.set(var->column, 0); // P[var->value] -= d; // } // } constexpr Float one{ 1 }; constexpr Float two{ 2 }; if (!valid) { do { ++i; value += R[i].a; valid = b[k].min <= value; auto var = row_begin + R[i].id; x.set(var->column); P[var->value] += delta + (kappa / (one - kappa)) * (R[i].value / two); } while (!valid && i + 1 < r_size); } valid = b[k].min <= value && value <= b[k].max; while (i + 1 < r_size && valid) { ++i; value += R[i].a; valid = b[k].min <= value && value <= b[k].max; auto var = row_begin + R[i].id; if (valid) valid = stop_iterating<Mode>(R[i].value, rng); if (valid) { x.set(var->column); P[var->value] += delta + (kappa / (one - kappa)) * (R[i].value / two); } else { x.unset(var->column); P[var->value] -= delta + (kappa / (one - kappa)) * (R[i].value / two); } } while (i + 1 < r_size) { ++i; auto var = row_begin + R[i].id; x.unset(var->column); P[var->value] -= delta + (kappa / (one - kappa)) * (R[i].value / two); } bx_expects(is_valid_constraint(*this, k, x)); } return false; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x88, %rsp vmovss %xmm1, 0xc(%rsp) vmovss 0x4064ad(%rip), %xmm1 # 0x459ac4 leaq 0x8(%rdi), %r14 leaq 0x50(%rsp), %r15 movq %rdi, %r12 vmovss %xmm2, 0x3c(%rsp) movq %rcx, 0x68(%rsp) movq %rsi, 0x10(%rsp) movq %rdi, 0x18(%rsp) movq %r14, 0x60(%rsp) vsubss %xmm0, %xmm1, %xmm1 vdivss %xmm1, %xmm0, %xmm0 vmovss %xmm0, 0x8(%rsp) cmpq 0x68(%rsp), %rdx je 0x539fa movslq (%rdx), %r13 cmpl 0x80(%r12), %r13d jge 0x53a0e leaq 0x28(%rsp), %rdi movq %rdx, 0x70(%rsp) movq %r14, %rsi movl %r13d, %edx callq 0x3de66 vmovss 0x3c(%rsp), %xmm0 movq 0x28(%rsp), %rdx movq 0x30(%rsp), %rsi movq %r12, %rdi callq 0x53a92 movq 0x30(%rsp), %rbx xorl %ebp, %ebp cmpq 0x28(%rsp), %rbx je 0x5372d movl 0x4(%rbx), %edx movq %r15, %rdi movq %r14, %rsi callq 0x3dede movq 0x50(%rsp), %rcx movq 0x58(%rsp), %rdx movq 0x48(%r12), %rax movq 0x68(%r12), %rsi vxorps %xmm0, %xmm0, %xmm0 cmpq %rcx, %rdx je 0x536ea movslq (%rdx), %rdi addq $0x8, %rdx vcvtsi2ssl (%rax,%rdi,4), %xmm3, %xmm1 vfmadd231ss (%rsi,%rdi,4), %xmm1, %xmm0 # xmm0 = (xmm1 * mem) + xmm0 movq %rdx, 0x58(%rsp) jmp 0x536cc movq 0x50(%r12), %rcx imulq $0xc, %rbp, %rdx movl %ebp, 0x4(%rcx,%rdx) incq %rbp movslq (%rbx), %rsi addq $0x8, %rbx movl (%rax,%rsi,4), %eax movl %eax, 0x8(%rcx,%rdx) movq 0x70(%r12), %rax movq 0x30(%rsp), %rsi movslq 0x4(%rsi), %rsi movq 0x8(%rax), %rax vmovss (%rax,%rsi,4), %xmm1 vsubss %xmm0, %xmm1, %xmm0 vmovss %xmm0, (%rcx,%rdx) jmp 0x5369b movq 0x50(%r12), %rdi movq (%r12), %rdx movl %ebp, %eax imulq $0xc, %rax, %rsi addq %rdi, %rsi callq 0x53aaf movq 0x58(%r12), %rax imulq $0xc, %r13, %rdx movq %r13, 0x40(%rsp) movq %rbp, 0x78(%rsp) movq %rdx, 0x48(%rsp) cmpl $0x0, (%rax,%rdx) jle 0x53834 leal -0x2(%rbp), %eax movabsq $-0x100000000, %r14 # imm = 0xFFFFFFFF00000000 xorl %r15d, %r15d cltq movq %rax, 0x80(%rsp) movq 0x50(%r12), %rax pushq $-0x1 popq %rbx xorl %ebp, %ebp movabsq $0x100000000, %rcx # imm = 0x100000000 movq 0x30(%rsp), %r13 movq 0x10(%rsp), %rdi addl 0x8(%rax,%r15), %ebp addq %rcx, %r14 movq 0x58(%r12), %rcx movslq 0x4(%rax,%r15), %r12 movl (%rcx,%rdx), %ecx movl 0x4(%r13,%r12,8), %esi movl %ecx, 0x20(%rsp) callq 0x369c8 movq 0x18(%rsp), %rax movslq (%r13,%r12,8), %rcx movq 0x18(%rsp), %r12 vmovss 0x4062f8(%rip), %xmm0 # 0x459ad0 vmovss 0x8(%rsp), %xmm1 movq 0x50(%rax), %rax movq 0x68(%r12), %rdx vmulss (%rax,%r15), %xmm0, %xmm0 vfmadd213ss 0xc(%rsp), %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + mem vaddss (%rdx,%rcx,4), %xmm0, %xmm0 vmovss %xmm0, (%rdx,%rcx,4) movq 0x48(%rsp), %rdx cmpl %ebp, 0x20(%rsp) jle 0x53822 addq $0xc, %r15 leaq 0x1(%rbx), %rcx cmpq 0x80(%rsp), %rbx movq %rcx, %rbx jl 0x5378a movq 0x58(%r12), %rax sarq $0x20, %r14 cmpl %ebp, (%rax,%rdx) jle 0x5383a xorl %eax, %eax jmp 0x53841 xorl %ebp, %ebp pushq $-0x1 popq %r14 cmpl 0x4(%rax,%rdx), %ebp setle %al movslq 0x78(%rsp), %rcx imulq $0xc, %r14, %r15 leaq 0x1(%r14), %rbx movq %rcx, 0x20(%rsp) incq %r14 cmpq 0x20(%rsp), %r14 jae 0x53956 testb $0x1, %al je 0x53956 movq 0x50(%r12), %rax movq 0x58(%r12), %rcx addl 0x14(%rax,%r15), %ebp cmpl %ebp, (%rcx,%rdx) jle 0x5388d movslq 0x10(%rax,%r15), %r13 shlq $0x3, %r13 addq 0x30(%rsp), %r13 jmp 0x538fd movslq 0x10(%rax,%r15), %r13 addq %rdx, %rcx shlq $0x3, %r13 addq 0x30(%rsp), %r13 cmpl 0x4(%rcx), %ebp jg 0x538fd vmovss 0xc(%rax,%r15), %xmm0 movq (%r12), %rdi callq 0x53ae2 testb %al, %al je 0x538fd movl 0x4(%r13), %esi movq 0x10(%rsp), %rdi callq 0x369c8 movq 0x50(%r12), %rax vmovss 0x4061fe(%rip), %xmm0 # 0x459ad0 movq 0x68(%r12), %rcx vmovss 0x8(%rsp), %xmm1 vmulss 0xc(%rax,%r15), %xmm0, %xmm0 movslq (%r13), %rax vfmadd213ss 0xc(%rsp), %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + mem vaddss (%rcx,%rax,4), %xmm0, %xmm0 vmovss %xmm0, (%rcx,%rax,4) movb $0x1, %al jmp 0x53945 movl 0x4(%r13), %esi movq 0x10(%rsp), %rdi callq 0x36a06 movq 0x50(%r12), %rax vmovss 0x4061b8(%rip), %xmm0 # 0x459ad0 movq 0x68(%r12), %rcx vmovss 0x8(%rsp), %xmm1 vmulss 0xc(%rax,%r15), %xmm0, %xmm0 movslq (%r13), %rax vfmadd213ss 0xc(%rsp), %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + mem vmovss (%rcx,%rax,4), %xmm1 vsubss %xmm0, %xmm1, %xmm0 vmovss %xmm0, (%rcx,%rax,4) xorl %eax, %eax movq 0x48(%rsp), %rdx addq $0xc, %r15 incq %rbx jmp 0x53853 movq 0x40(%rsp), %r13 cmpq 0x20(%rsp), %rbx jae 0x539ce movq 0x50(%r12), %rax movq 0x30(%rsp), %r14 movq 0x10(%rsp), %rdi movslq 0x10(%rax,%r15), %r12 movl 0x4(%r14,%r12,8), %esi callq 0x36a06 movq 0x18(%rsp), %rax movq 0x18(%rsp), %rcx vmovss 0x40613e(%rip), %xmm0 # 0x459ad0 vmovss 0x8(%rsp), %xmm1 incq %rbx movq 0x50(%rax), %rax movq 0x68(%rcx), %rcx vmulss 0xc(%rax,%r15), %xmm0, %xmm0 movslq (%r14,%r12,8), %rax movq 0x18(%rsp), %r12 addq $0xc, %r15 vfmadd213ss 0xc(%rsp), %xmm1, %xmm0 # xmm0 = (xmm1 * xmm0) + mem vmovss (%rcx,%rax,4), %xmm1 vsubss %xmm0, %xmm1, %xmm0 vmovss %xmm0, (%rcx,%rax,4) jmp 0x5395b movq 0x10(%rsp), %rdx movq %r12, %rdi movl %r13d, %esi callq 0x52755 testb %al, %al je 0x53a2f movq 0x70(%rsp), %rdx movq 0x60(%rsp), %r14 leaq 0x50(%rsp), %r15 addq $0x4, %rdx jmp 0x5364b xorl %eax, %eax addq $0x88, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq leaq 0x4047c9(%rip), %rdi # 0x4581de leaq 0x406a5e(%rip), %rsi # 0x45a47a leaq 0x406824(%rip), %rdx # 0x45a247 leaq 0x406a56(%rip), %rcx # 0x45a480 callq 0x2813f leaq 0x4047a8(%rip), %rdi # 0x4581de leaq 0x406a47(%rip), %rsi # 0x45a484 leaq 0x406803(%rip), %rdx # 0x45a247 leaq 0x406a5a(%rip), %rcx # 0x45a4a5 callq 0x2813f
/quesnel[P]baryonyx/lib/src/random-solver.cpp
int baryonyx::itm::compute_order::local_compute_violated_constraints<baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::minimize_tag, baryonyx::itm::default_cost_type<float>>, baryonyx::bit_array>(baryonyx::itm::solver_random_inequalities_101coeff<float, baryonyx::itm::minimize_tag, baryonyx::itm::default_cost_type<float>> const&, baryonyx::bit_array const&)
int local_compute_violated_constraints(const Solver& slv, const Xtype& x) { int remaining = 0; for (int k = 0; k != slv.m; ++k) if (!is_valid_constraint(slv, k, x)) ++remaining; return remaining; }
pushq %rbp pushq %r15 pushq %r14 pushq %rbx pushq %rax movq %rdx, %rbx movq %rsi, %r14 xorl %ebp, %ebp xorl %r15d, %r15d cmpl 0x80(%r14), %r15d je 0x53a85 movq %r14, %rdi movl %r15d, %esi movq %rbx, %rdx callq 0x52755 xorb $0x1, %al incl %r15d movzbl %al, %eax addl %eax, %ebp jmp 0x53a62 movl %ebp, %eax addq $0x8, %rsp popq %rbx popq %r14 popq %r15 popq %rbp retq
/quesnel[P]baryonyx/lib/src/itm-common.hpp
void baryonyx::details::ap_pnm_observer::make_observation<double>(baryonyx::sparse_matrix<int> const&, double const*, double const*)
void make_observation(const sparse_matrix<int>& ap, const Float* P, const Float* /*pi*/) { static_assert(std::is_floating_point<Float>::value); colormap cm(-1.0f, 1.0f); pnm_array pnm(constraints, variables); if (!pnm) return; pnm.clear(); for (int k = 0; k != constraints; ++k) { auto [it, et] = ap.row(k); for (; it != et; ++it) { std::uint8_t* pointer = pnm(k, it->column); auto color_rgb = cm(P[it->value]); pointer[0] = color_rgb.red; pointer[1] = color_rgb.green; pointer[2] = color_rgb.blue; } } pnm(fmt::format("{}-P-{}.pnm", m_basename, m_frame++)); }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x68, %rsp vmovsd 0x3ed6d0(%rip), %xmm0 # 0x459b30 movq %rdx, %r14 movq %rsi, 0x38(%rsp) movq %rdi, %r15 movq %rsp, %rbx vmovsd %xmm0, 0x40(%rsp) movl (%rdi), %esi movl 0x4(%rdi), %edx movq %rbx, %rdi callq 0x43284 movq (%rbx), %rdi testq %rdi, %rdi je 0x6c574 movl 0xc(%rsp), %eax imull 0x8(%rsp), %eax leal (%rax,%rax,2), %eax testl %eax, %eax je 0x6c4a6 movl %eax, %edx xorl %esi, %esi callq 0xb1c0 leaq 0x40(%rsp), %r13 xorl %r12d, %r12d movq %rsp, %rbp movl (%r15), %eax cmpq %rax, %r12 je 0x6c51f movq 0x38(%rsp), %rsi leaq 0x10(%rsp), %rdi movl %r12d, %edx callq 0x3c868 movq 0x18(%rsp), %rax cmpq 0x10(%rsp), %rax je 0x6c51a movslq 0x4(%rax), %rdx movq %rbp, %rdi movq %r12, %rsi callq 0x432f6 movq 0x18(%rsp), %rcx movq %rax, %rbx movq %r13, %rdi movslq (%rcx), %rax vmovsd (%r14,%rax,8), %xmm0 callq 0x6c59e movb %al, (%rbx) movb %ah, 0x1(%rbx) shrl $0x10, %eax movb %al, 0x2(%rbx) movq 0x18(%rsp), %rax addq $0x8, %rax movq %rax, 0x18(%rsp) jmp 0x6c4d0 incq %r12 jmp 0x6c4b1 movl 0x8(%r15), %eax leal 0x1(%rax), %ecx movl %ecx, 0x8(%r15) vmovups 0x10(%r15), %xmm0 vmovaps %xmm0, 0x10(%rsp) movq %rax, 0x20(%rsp) leaq 0x3ee0ba(%rip), %rdi # 0x45a5fc callq 0xf277 leaq 0x48(%rsp), %rdi pushq $0x1d popq %rcx leaq 0x10(%rsp), %r8 movq %rax, %rsi callq 0x1adbb leaq 0x48(%rsp), %rbx movq %rsp, %rdi movq %rbx, %rsi callq 0x4335a movq %rbx, %rdi callq 0xe956 movq %rsp, %rdi callq 0x42eac addq $0x68, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq movq %rsp, %rdi movq %rax, %rbx callq 0x42eac movq %rbx, %rdi callq 0xb3d0
/quesnel[P]baryonyx/lib/src/observer.hpp
baryonyx::colormap::rgb baryonyx::colormap::operator()<double>(double)
rgb operator()(T v_) noexcept { float v = static_cast<float>(v_); if (v < m_lower) v = m_lower; if (v > m_upper) v = m_upper; float dv = m_upper - m_lower; float r = 1.f, g = 1.f, b = 1.f; if (v < (m_lower + 0.25f * dv)) { r = 0.f; g = 4.f * (v - m_lower) / dv; } else if (v < (m_lower + 0.5f * dv)) { r = 0.f; b = 1.f + 4.f * (m_lower + 0.25f * dv - v) / dv; } else if (v < (m_lower + 0.75f * dv)) { r = 4.f * (v - m_lower - 0.5f * dv) / dv; b = 0.f; } else { g = 1.f + 4.f * (m_lower + 0.75f * dv - v) / dv; b = 0.f; } return rgb(static_cast<std::uint8_t>(r * 255.f), static_cast<std::uint8_t>(g * 255.f), static_cast<std::uint8_t>(b * 255.f)); }
vmovss (%rdi), %xmm1 vmovss 0x4(%rdi), %xmm3 vcvtsd2ss %xmm0, %xmm0, %xmm0 vmaxss %xmm0, %xmm1, %xmm0 vminss %xmm0, %xmm3, %xmm2 vsubss %xmm1, %xmm3, %xmm0 vmovss 0x3ed515(%rip), %xmm3 # 0x459ad4 vfmadd213ss %xmm1, %xmm0, %xmm3 # xmm3 = (xmm0 * xmm3) + xmm1 vucomiss %xmm2, %xmm3 jbe 0x6c5e3 vsubss %xmm1, %xmm2, %xmm1 vmulss 0x3ed506(%rip), %xmm1, %xmm1 # 0x459adc movb $-0x1, %cl xorl %eax, %eax vdivss %xmm0, %xmm1, %xmm0 jmp 0x6c680 vmovss 0x3ed4e5(%rip), %xmm4 # 0x459ad0 vfmadd213ss %xmm1, %xmm0, %xmm4 # xmm4 = (xmm0 * xmm4) + xmm1 vucomiss %xmm2, %xmm4 jbe 0x6c622 vsubss %xmm2, %xmm3, %xmm1 vmulss 0x3ed4da(%rip), %xmm1, %xmm1 # 0x459adc xorl %eax, %eax vdivss %xmm0, %xmm1, %xmm1 vmovss 0x3ed4b4(%rip), %xmm0 # 0x459ac4 vaddss %xmm0, %xmm1, %xmm1 vmulss 0x3ed4c8(%rip), %xmm1, %xmm1 # 0x459ae4 vcvttss2si %xmm1, %ecx jmp 0x6c680 vmovss 0x3ed4ae(%rip), %xmm3 # 0x459ad8 vfmadd213ss %xmm1, %xmm0, %xmm3 # xmm3 = (xmm0 * xmm3) + xmm1 vucomiss %xmm2, %xmm3 jbe 0x6c664 vsubss %xmm1, %xmm2, %xmm1 vfmadd231ss 0x3ed49e(%rip), %xmm0, %xmm1 # xmm1 = (xmm0 * mem) + xmm1 vmulss 0x3ed492(%rip), %xmm1, %xmm1 # 0x459adc vdivss %xmm0, %xmm1, %xmm0 vmulss 0x3ed48e(%rip), %xmm0, %xmm0 # 0x459ae4 vcvttss2si %xmm0, %eax vmovss 0x3ed462(%rip), %xmm0 # 0x459ac4 jmp 0x6c67e vsubss %xmm2, %xmm3, %xmm1 vmulss 0x3ed46c(%rip), %xmm1, %xmm1 # 0x459adc movb $-0x1, %al vdivss %xmm0, %xmm1, %xmm0 vaddss 0x3ed446(%rip), %xmm0, %xmm0 # 0x459ac4 xorl %ecx, %ecx vmulss 0x3ed45c(%rip), %xmm0, %xmm0 # 0x459ae4 movzbl %cl, %ecx movzbl %al, %eax shll $0x10, %ecx vcvttss2si %xmm0, %edx movzbl %dl, %edx shll $0x8, %edx orl %ecx, %edx orl %edx, %eax retq
/quesnel[P]baryonyx/lib/src/pnm.hpp
void baryonyx::details::ap_file_observer::make_observation<double>(baryonyx::sparse_matrix<int> const&, double const*, double const*)
void make_observation(const sparse_matrix<int>& ap, const Float* P, const Float* /*pi*/) { static_assert(std::is_floating_point<Float>::value); std::ofstream ofs(fmt::format("{}-P-{}.txt", m_basename, m_frame++)); for (int k = 0; k != constraints; ++k) { std::fill_n(std::begin(m_value), variables, 0.0f); auto [it, et] = ap.row(k); for (; it != et; ++it) m_value[it->column] = static_cast<float>(P[it->value]); std::copy(m_value.begin(), m_value.end(), std::ostream_iterator<Float>(ofs, " ")); ofs << '\n'; } }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x258, %rsp # imm = 0x258 movl 0x8(%rdi), %eax movq %rdi, %r15 movq %rdx, %rbx movq %rsi, %r14 movq %rsp, %r12 leal 0x1(%rax), %ecx movl %ecx, 0x8(%rdi) vmovups 0x10(%rdi), %xmm0 leaq 0x3eddd1(%rip), %rdi # 0x45a637 vmovaps %xmm0, (%r12) movq %rax, 0x10(%r12) callq 0xf277 leaq 0x38(%rsp), %r13 pushq $0x1d popq %rcx movq %r13, %rdi movq %rax, %rsi movq %r12, %r8 callq 0x1adbb leaq 0x58(%rsp), %r12 pushq $0x10 popq %rdx movq %r12, %rdi movq %r13, %rsi callq 0xb120 leaq 0x38(%rsp), %rdi callq 0xe956 xorl %ebp, %ebp movq %rsp, %r13 cmpl (%r15), %ebp je 0x6c93c movq 0x30(%r15), %rdi movl 0x4(%r15), %esi andl $0x0, (%rsp) movq %r13, %rdx callq 0x43a03 movq %r13, %rdi movq %r14, %rsi movl %ebp, %edx callq 0x3c868 movq (%rsp), %rax movq 0x8(%rsp), %rcx movq 0x30(%r15), %rsi cmpq %rax, %rcx je 0x6c906 movslq (%rcx), %rdx vcvtsd2ss (%rbx,%rdx,8), %xmm1, %xmm0 movslq 0x4(%rcx), %rdx addq $0x8, %rcx vmovss %xmm0, (%rsi,%rdx,4) movq %rcx, 0x8(%rsp) jmp 0x6c8e5 movq 0x38(%r15), %rdx leaq 0x3f6e34(%rip), %rax # 0x463745 movq %r12, 0x28(%rsp) movq %rax, 0x30(%rsp) leaq 0x38(%rsp), %rdi leaq 0x28(%rsp), %rcx callq 0x6c980 movq %r12, %rdi pushq $0xa popq %rsi callq 0xb400 incl %ebp jmp 0x6c8ae leaq 0x58(%rsp), %rdi callq 0xb4d0 addq $0x258, %rsp # imm = 0x258 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq leaq 0x38(%rsp), %rdi movq %rax, %rbx callq 0xe956 jmp 0x6c978 jmp 0x6c96b jmp 0x6c96b leaq 0x58(%rsp), %rdi movq %rax, %rbx callq 0xb4d0 movq %rbx, %rdi callq 0xb3d0
/quesnel[P]baryonyx/lib/src/observer.hpp
baryonyx::itm::solver_functor<baryonyx::itm::solver_random_inequalities_101coeff<double, baryonyx::itm::maximize_tag, baryonyx::itm::default_cost_type<double>>, double, baryonyx::itm::maximize_tag, baryonyx::itm::default_cost_type<double>, baryonyx::none_observer>::store_if_better(baryonyx::bit_array const&, double, long)
inline bool is_better_solution(Float lhs, Float rhs) noexcept { if constexpr (std::is_same_v<Mode, minimize_tag>) return lhs < rhs; else return lhs > rhs; }
vucomisd 0x30(%rdi), %xmm0 jbe 0x6cb0c pushq %r14 pushq %rbx pushq %rax movq %rdi, %r14 addq $0x20, %rdi movq %rdx, %rbx vmovsd %xmm0, (%rsp) callq 0x36a44 movq %r14, %rdi callq 0x6cb86 vmovsd (%rsp), %xmm1 vmovsd %xmm0, 0x38(%r14) movq %rbx, 0x48(%r14) andl $0x0, 0x50(%r14) vmovsd %xmm1, 0x30(%r14) addq $0x8, %rsp popq %rbx popq %r14 retq nop
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::result baryonyx::itm::optimize_problem<baryonyx::itm::solver_random_inequalities_101coeff<double, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<double>>, double, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<double>>(baryonyx::context const&, baryonyx::problem const&)
inline result optimize_problem(const context& ctx, const problem& pb) { result r; if (ctx.start) ctx.start(ctx.parameters); auto constraints{ make_merged_constraints(ctx, pb) }; if (constraints.empty() || pb.vars.values.empty()) { r.status = result_status::success; r.solutions.resize(1); r.solutions.back().value = pb.objective.value; r.strings = pb.strings; r.affected_vars = pb.affected_vars; r.variable_name = pb.vars.names; return r; } random_engine rng(init_random_generator_seed(ctx)); auto variables = length(pb.vars.values); auto cost = Cost(pb.objective, variables); auto cost_constant = pb.objective.value; const auto thread = get_thread_number(ctx); std::vector<optimize_functor<Solver, Float, Mode, Cost>> functors; std::vector<std::thread> pool(thread); best_solution_recorder<Cost, Float, Mode> best_recorder( rng, thread, cost, cost_constant, variables, constraints, ctx.parameters.init_population_size); auto seeds = generate_seed(rng, thread); std::atomic_bool stop_task; stop_task.store(false); for (unsigned i = 0u; i != thread; ++i) functors.emplace_back(ctx, i, seeds[i]); for (unsigned i = 0u; i != thread; ++i) pool[i] = std::thread(std::ref(functors[i]), std::ref(stop_task), std::ref(best_recorder), std::cref(constraints), variables, std::cref(cost), cost_constant); const auto start = std::chrono::steady_clock::now(); auto end = start; do { std::this_thread::sleep_for(std::chrono::seconds{ 1L }); if (ctx.update) { auto call_number = 0L; for (auto i = 0u; i != thread; ++i) call_number += functors[i].m_call_number; int constraints_remaining; long int loop; double value; double duration; best_recorder.get_best( constraints_remaining, value, duration, loop); ctx.update( constraints_remaining, value, loop, duration, call_number); } end = std::chrono::steady_clock::now(); } while (!is_time_limit(ctx.parameters.time_limit, start, end)); stop_task.store(true); for (auto& t : pool) t.join(); r.strings = pb.strings; r.affected_vars = pb.affected_vars; r.variable_name = pb.vars.names; r.variables = variables; r.constraints = length(constraints); const auto& first = best_recorder.get_best(0); if (!first.is_solution()) r.status = result_status::time_limit_reached; else r.status = result_status::success; r.duration = first.duration; r.loop = first.loop; r.remaining_constraints = first.remaining_constraints; switch (ctx.parameters.storage) { case solver_parameters::storage_type::one: { r.solutions.resize(1); convert(first, r.solutions[0], variables); } break; case solver_parameters::storage_type::bound: { r.solutions.resize(2); convert(first, r.solutions[0], variables); convert(best_recorder.get_worst(), r.solutions[1], variables); } break; case solver_parameters::storage_type::five: { r.solutions.resize(5); for (int i = 0; i != 5; ++i) convert(best_recorder.get_best(i), r.solutions[i], variables); } break; } best_recorder.show_population(ctx); if (ctx.finish) ctx.finish(r); return r; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x198, %rsp # imm = 0x198 vxorpd %xmm0, %xmm0, %xmm0 movq %rdx, %r13 movq %rsi, %r15 movq %rdi, %r12 vmovupd %zmm0, 0x58(%rdi) vmovupd %zmm0, 0x40(%rdi) vmovupd %zmm0, (%rdi) movq $0x7fffffff, 0x98(%rdi) # imm = 0x7FFFFFFF movl $0x2, 0xa0(%rdi) cmpq $0x0, 0x128(%rsi) je 0x6cc0b leaq 0x118(%r15), %rdi movq %r15, %rsi vzeroupper callq 0x3527e leaq 0x48(%rsp), %rdi movq %r15, %rsi movq %r13, %rdx vzeroupper callq 0x450078 movq 0x48(%rsp), %rax cmpq 0x50(%rsp), %rax je 0x6cd6a movq 0xa8(%r13), %rax cmpq 0xb0(%r13), %rax je 0x6cd6a movq %r15, %rdi callq 0x353ba movl $0x7fffffff, %ecx # imm = 0x7FFFFFFF xorl %edx, %edx divq %rcx cmpq $0x1, %rdx adcq $0x0, %rdx movq %rdx, 0x40(%rsp) movq 0xb0(%r13), %rax subq 0xa8(%r13), %rax pushq $0xc popq %rcx cqto leaq 0x10(%r13), %rsi idivq %rcx movl %eax, 0x4(%rsp) leaq 0xb8(%rsp), %rdi movl %eax, %edx movq %r12, 0x10(%rsp) callq 0x6d526 vmovsd 0x40(%r13), %xmm0 vmovsd %xmm0, 0x38(%rsp) movq %r15, %rdi callq 0x35447 andq $0x0, 0x70(%rsp) vxorpd %xmm0, %xmm0, %xmm0 movl %eax, %ebp vmovapd %xmm0, 0x60(%rsp) leaq 0xa0(%rsp), %rdi leaq 0xd8(%rsp), %rdx movq %rbp, %rsi callq 0x35462 vmovsd 0x38(%rsp), %xmm0 movl 0xc4(%r15), %eax movl 0x4(%rsp), %r8d subq $0x8, %rsp movl %ebp, %edx leaq 0xe0(%rsp), %rdi leaq 0x48(%rsp), %rsi leaq 0xc0(%rsp), %rcx leaq 0x50(%rsp), %r9 pushq %rax callq 0x6d740 popq %rax popq %rcx leaq 0x30(%rsp), %rdi leaq 0x40(%rsp), %rsi movl %ebp, %edx callq 0x3551c xorl %eax, %eax movb %al, 0x3(%rsp) xorl %ecx, %ecx leaq 0x60(%rsp), %rbx leaq 0x8(%rsp), %r14 xchgb %cl, 0x3(%rsp) leaq 0x90(%r13), %rcx movq %rcx, 0x88(%rsp) movl %eax, 0x8(%rsp) cmpl %ebp, %eax je 0x6cdc5 movl %eax, %ecx shlq $0x3, %rcx addq 0x30(%rsp), %rcx movq %rbx, %rdi movq %r15, %rsi movq %r14, %rdx callq 0x6d7a6 movl 0x8(%rsp), %eax incl %eax jmp 0x6cd41 andl $0x0, 0xa0(%r12) leaq 0x68(%r12), %rdi pushq $0x1 popq %rsi callq 0x35292 vmovsd 0x40(%r13), %xmm0 movq 0x70(%r12), %rax vmovsd %xmm0, -0x8(%rax) movq %r12, %rdi movq %r13, %rsi callq 0x31d28 leaq 0xc0(%r13), %rsi leaq 0x20(%r12), %rdi callq 0x352c2 addq $0x90, %r13 leaq 0x50(%r12), %rdi movq %r13, %rsi callq 0x352ec jmp 0x6d160 movq %r13, 0x80(%rsp) movq %r15, %r13 leaq 0x8(%rsp), %r15 leaq 0x98(%rsp), %r14 leaq 0x4(%rsp), %rbx xorl %r12d, %r12d cmpq %rbp, %r12 je 0x6ce89 imulq $0xc0, %r12, %rax addq 0x60(%rsp), %rax leaq 0x3(%rsp), %r10 leaq 0xd8(%rsp), %r11 movq %r10, 0x20(%rsp) leaq 0x48(%rsp), %r10 movq %r11, 0x18(%rsp) movq %r10, 0x98(%rsp) movq %rax, 0x28(%rsp) leaq 0xb8(%rsp), %rax movq %rax, 0x90(%rsp) leaq 0x20(%rsp), %rdx leaq 0x38(%rsp), %rax movq %r15, %rdi leaq 0x28(%rsp), %rsi leaq 0x18(%rsp), %rcx movq %r14, %r8 movq %rbx, %r9 pushq %rax leaq 0x98(%rsp), %rax pushq %rax callq 0x6d7f2 popq %rax popq %rcx leaq (,%r12,8), %rdi addq 0xa0(%rsp), %rdi movq %r15, %rsi callq 0x356d6 movq %r15, %rdi callq 0x356f0 incq %r12 jmp 0x6cde5 callq 0xb5a0 imulq $0xc0, %rbp, %r15 leaq 0x138(%r13), %r12 leaq 0x8(%rsp), %rbp movq %rax, %rbx movq $0x1, 0x8(%rsp) movq %rbp, %rdi callq 0x356fd cmpq $0x0, 0x148(%r13) je 0x6cf1e movq 0x60(%rsp), %rax xorl %ecx, %ecx xorl %r14d, %r14d cmpq %rcx, %r15 je 0x6cedf addq 0xb0(%rax,%rcx), %r14 addq $0xc0, %rcx jmp 0x6cec9 leaq 0xe0(%rsp), %rdi leaq 0x18(%rsp), %rsi leaq 0x28(%rsp), %rdx leaq 0x20(%rsp), %rcx movq %rbp, %r8 callq 0x7611c vmovsd 0x28(%rsp), %xmm0 vmovsd 0x20(%rsp), %xmm1 movq 0x8(%rsp), %rdx movl 0x18(%rsp), %esi movq %r12, %rdi movq %r14, %rcx callq 0x35736 callq 0xb5a0 vmovsd (%r13), %xmm0 subq %rbx, %rax vxorpd %xmm1, %xmm1, %xmm1 vucomisd %xmm0, %xmm1 vcvtsi2sd %rax, %xmm2, %xmm1 vdivsd 0x3ecb3f(%rip), %xmm1, %xmm1 # 0x459a80 jae 0x6cea4 vucomisd %xmm0, %xmm1 jbe 0x6cea4 movb $0x1, %al xchgb %al, 0x3(%rsp) movq 0xa0(%rsp), %rbx movq 0xa8(%rsp), %r14 movq 0x10(%rsp), %r12 cmpq %r14, %rbx je 0x6cf7f movq %rbx, %rdi callq 0xb1a0 addq $0x8, %rbx jmp 0x6cf6c movq 0x80(%rsp), %rbx movq %r12, %rdi movq %rbx, %rsi callq 0x31d28 addq $0xc0, %rbx leaq 0x20(%r12), %rdi movq %rbx, %rsi callq 0x352c2 leaq 0x50(%r12), %rdi movq 0x88(%rsp), %rsi callq 0x352ec movl 0x4(%rsp), %eax movl %eax, 0x90(%r12) movq 0x50(%rsp), %rax subq 0x48(%rsp), %rax pushq $0x28 popq %rcx cqto xorl %esi, %esi idivq %rcx movq 0x118(%rsp), %rdi movq 0x130(%rsp), %rcx movl %eax, 0x94(%r12) movslq (%rdi), %rax imulq $0x38, %rax, %rax movl 0x30(%rcx,%rax), %edx leaq (%rcx,%rax), %rbx testl %edx, %edx setne %sil leal (%rsi,%rsi,2), %esi movl %esi, 0xa0(%r12) vmovsd 0x18(%rcx,%rax), %xmm0 vmovsd %xmm0, 0x80(%r12) movq 0x28(%rcx,%rax), %rax movq %rax, 0x88(%r12) movl %edx, 0x98(%r12) movl 0xe8(%r13), %eax testl %eax, %eax je 0x6d0da cmpl $0x1, %eax je 0x6d0a2 cmpl $0x2, %eax jne 0x6d0f9 leaq 0x68(%r12), %rbx pushq $0x5 popq %rsi movq %rbx, %rdi callq 0x35292 xorl %r14d, %r14d xorl %r15d, %r15d cmpq $0x5, %r15 je 0x6d0f9 movq 0x118(%rsp), %rax movq (%rbx), %rsi movl 0x4(%rsp), %edx movslq (%rax,%r15,4), %rax addq %r14, %rsi imulq $0x38, %rax, %rdi addq 0x130(%rsp), %rdi callq 0x35781 incq %r15 addq $0x20, %r14 jmp 0x6d068 leaq 0x68(%r12), %r14 pushq $0x2 popq %rsi movq %r14, %rdi callq 0x35292 movl 0x4(%rsp), %edx movq (%r14), %rsi movq %rbx, %rdi callq 0x35781 leaq 0xe0(%rsp), %rdi callq 0x7619a movq (%r14), %rsi movq %rax, %rbx addq $0x20, %rsi jmp 0x6d0ed leaq 0x68(%r12), %r14 pushq $0x1 popq %rsi movq %r14, %rdi callq 0x35292 movq (%r14), %rsi movl 0x4(%rsp), %edx movq %rbx, %rdi callq 0x35781 leaq 0xd8(%rsp), %rdi movq %r13, %rsi callq 0x6d8a4 cmpq $0x0, 0x168(%r13) je 0x6d125 addq $0x158, %r13 # imm = 0x158 movq %r13, %rdi movq %r12, %rsi callq 0x357ea leaq 0x30(%rsp), %rdi callq 0x357fe leaq 0xd8(%rsp), %rdi callq 0x6d8b8 leaq 0xa0(%rsp), %rdi callq 0x35836 leaq 0x60(%rsp), %rdi callq 0x7627a leaq 0xb8(%rsp), %rdi callq 0x6d8d6 leaq 0x48(%rsp), %rdi callq 0x35858 movq %r12, %rax addq $0x198, %rsp # imm = 0x198 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq movq %rax, %rbx jmp 0x6d1c1 movq %rax, %rbx jmp 0x6d1ce movq %rax, %rbx jmp 0x6d1db jmp 0x6d1a5 jmp 0x6d196 jmp 0x6d1b4 jmp 0x6d1b4 movq %r12, 0x10(%rsp) movq %rax, %rbx jmp 0x6d1fc movq %r12, 0x10(%rsp) movq %rax, %rbx jmp 0x6d1f2 jmp 0x6d1b4 jmp 0x6d1b4 jmp 0x6d1b4 jmp 0x6d1b4 jmp 0x6d1b4 movq %rax, %rbx leaq 0x30(%rsp), %rdi callq 0x357fe leaq 0xd8(%rsp), %rdi callq 0x6d8b8 leaq 0xa0(%rsp), %rdi callq 0x35836 leaq 0x60(%rsp), %rdi callq 0x7627a leaq 0xb8(%rsp), %rdi callq 0x6d8d6 leaq 0x48(%rsp), %rdi callq 0x35858 movq 0x10(%rsp), %rdi callq 0xea60 movq %rbx, %rdi callq 0xb3d0
/quesnel[P]baryonyx/lib/src/itm-optimizer-common.hpp
baryonyx::result baryonyx::itm::solve_problem<baryonyx::itm::solver_random_inequalities_101coeff<double, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<double>>, double, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<double>>(baryonyx::context const&, baryonyx::problem const&)
inline result solve_problem(const context& ctx, const problem& pb) { if (ctx.start) ctx.start(ctx.parameters); result ret; auto variables = length(pb.vars.values); auto constraints{ make_merged_constraints(ctx, pb) }; if (!constraints.empty() && !pb.vars.values.empty()) { random_engine rng(init_random_generator_seed(ctx)); auto cost = Cost(pb.objective, variables); auto cost_constant = pb.objective.value; switch (ctx.parameters.observer) { case solver_parameters::observer_type::pnm: { using obs = pnm_observer; solver_functor<Solver, Float, Mode, Cost, obs> slv(ctx, rng); ret = slv(constraints, variables, cost, cost_constant); } break; case solver_parameters::observer_type::file: { using obs = file_observer; solver_functor<Solver, Float, Mode, Cost, obs> slv(ctx, rng); ret = slv(constraints, variables, cost, cost_constant); } break; default: { using obs = none_observer; solver_functor<Solver, Float, Mode, Cost, obs> slv(ctx, rng); ret = slv(constraints, variables, cost, cost_constant); break; } } } else { ret.status = result_status::success; ret.solutions.resize(1); ret.solutions.back().value = pb.objective.value; } ret.strings = pb.strings; ret.variable_name = std::move(pb.vars.names); ret.affected_vars = std::move(pb.affected_vars); ret.variables = variables; ret.constraints = length(constraints); if (ctx.finish) ctx.finish(ret); return ret; }
pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x140, %rsp # imm = 0x140 cmpq $0x0, 0x128(%rsi) movq %rdx, %r15 movq %rsi, %r14 movq %rdi, %rbx je 0x6d240 leaq 0x118(%r14), %rdi movq %r14, %rsi callq 0x3527e vxorps %xmm0, %xmm0, %xmm0 vmovups %zmm0, 0x58(%rbx) vmovups %zmm0, 0x40(%rbx) vmovups %zmm0, (%rbx) movq $0x7fffffff, 0x98(%rbx) # imm = 0x7FFFFFFF movl $0x2, 0xa0(%rbx) movq 0xb0(%r15), %rax subq 0xa8(%r15), %rax pushq $0xc popq %rcx cqto idivq %rcx movq %rax, %r12 leaq 0x8(%rsp), %rdi movq %r14, %rsi movq %r15, %rdx vzeroupper callq 0x450078 movq 0x8(%rsp), %rax cmpq 0x10(%rsp), %rax je 0x6d369 movq 0xa8(%r15), %rax cmpq 0xb0(%r15), %rax je 0x6d369 movq %r14, %rdi callq 0x353ba movl $0x7fffffff, %ecx # imm = 0x7FFFFFFF xorl %edx, %edx leaq 0x10(%r15), %rsi divq %rcx cmpq $0x1, %rdx adcq $0x0, %rdx movq %rdx, (%rsp) leaq 0x20(%rsp), %rdi movl %r12d, %edx callq 0x6d526 vmovsd 0x40(%r15), %xmm0 movl 0xe4(%r14), %eax vxorps %xmm1, %xmm1, %xmm1 leaq 0x40(%rsp), %rsi cmpl $0x1, %eax je 0x6d390 cmpl $0x2, %eax jne 0x6d3df movabsq $-0x10000000000000, %r9 # imm = 0xFFF0000000000000 vmovaps %xmm1, (%rsi) movq %r14, 0x10(%rsi) movq %rsp, %rax movq %rax, 0x18(%rsi) vmovaps %xmm1, 0x20(%rsi) movq %r9, 0x30(%rsi) andq $0x0, 0x48(%rsi) vmovups %xmm1, 0x38(%rsi) movl $0x7fffffff, 0x50(%rsi) # imm = 0x7FFFFFFF leaq 0x98(%rsp), %rdi leaq 0x8(%rsp), %rdx leaq 0x20(%rsp), %r8 movl %r12d, %ecx callq 0x7690c jmp 0x6d42c andl $0x0, 0xa0(%rbx) leaq 0x68(%rbx), %rdi pushq $0x1 popq %rsi callq 0x35292 vmovsd 0x40(%r15), %xmm0 movq 0x70(%rbx), %rax vmovsd %xmm0, -0x8(%rax) jmp 0x6d45b movabsq $-0x10000000000000, %r9 # imm = 0xFFF0000000000000 vmovaps %xmm1, (%rsi) movq %r14, 0x10(%rsi) movq %rsp, %rax movq %rax, 0x18(%rsi) vmovaps %xmm1, 0x20(%rsi) movq %r9, 0x30(%rsi) andq $0x0, 0x48(%rsi) vmovups %xmm1, 0x38(%rsi) movl $0x7fffffff, 0x50(%rsi) # imm = 0x7FFFFFFF leaq 0x98(%rsp), %rdi leaq 0x8(%rsp), %rdx leaq 0x20(%rsp), %r8 movl %r12d, %ecx callq 0x762a2 jmp 0x6d42c movabsq $-0x10000000000000, %r9 # imm = 0xFFF0000000000000 vmovaps %xmm1, (%rsi) movq %r14, 0x10(%rsi) movq %rsp, %rax movq %rax, 0x18(%rsi) vmovaps %xmm1, 0x20(%rsi) movq %r9, 0x30(%rsi) andq $0x0, 0x48(%rsi) vmovups %xmm1, 0x38(%rsi) movl $0x7fffffff, 0x50(%rsi) # imm = 0x7FFFFFFF leaq 0x98(%rsp), %rdi leaq 0x8(%rsp), %rdx leaq 0x20(%rsp), %r8 movl %r12d, %ecx callq 0x76f76 leaq 0x98(%rsp), %r13 movq %rbx, %rdi movq %r13, %rsi callq 0x41d9e movq %r13, %rdi callq 0xea60 leaq 0x68(%rsp), %rdi callq 0x357fe leaq 0x20(%rsp), %rdi callq 0x6d8d6 leaq 0x90(%r15), %r13 movq %rbx, %rdi movq %r15, %rsi callq 0x31d28 leaq 0x50(%rbx), %rdi movq %r13, %rsi callq 0x352ec addq $0xc0, %r15 leaq 0x20(%rbx), %rdi movq %r15, %rsi callq 0x352c2 movq 0x10(%rsp), %rax movl %r12d, 0x90(%rbx) subq 0x8(%rsp), %rax pushq $0x28 popq %rcx cqto idivq %rcx movl %eax, 0x94(%rbx) cmpq $0x0, 0x168(%r14) je 0x6d4c7 addq $0x158, %r14 # imm = 0x158 movq %r14, %rdi movq %rbx, %rsi callq 0x357ea leaq 0x8(%rsp), %rdi callq 0x35858 movq %rbx, %rax addq $0x140, %rsp # imm = 0x140 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 retq jmp 0x6d4e9 jmp 0x6d4e9 leaq 0x68(%rsp), %rdi movq %rax, %r14 callq 0x357fe leaq 0x20(%rsp), %rdi callq 0x6d8d6 jmp 0x6d50c jmp 0x6d509 movq %rax, %r14 jmp 0x6d516 movq %rax, %r14 leaq 0x8(%rsp), %rdi callq 0x35858 movq %rbx, %rdi callq 0xea60 movq %r14, %rdi callq 0xb3d0
/quesnel[P]baryonyx/lib/src/itm-solver-common.hpp
baryonyx::itm::quadratic_cost_type<double>::quadratic_cost_type(baryonyx::objective_function const&, int)
quadratic_cost_type(const objective_function& obj_, int n) : obj(obj_) , linear_elements(std::make_unique<Float[]>(n)) , quadratic_elements( std::make_unique<quad[]>(2 * obj.qelements.size() + 1)) , indices(std::make_unique<int[]>(n + 1)) { for (int i = 0, e = length(obj.elements); i != e; ++i) { bx_ensures(0 <= obj.elements[i].variable_index && obj.elements[i].variable_index < n); linear_elements[obj.elements[i].variable_index] += static_cast<Float>(obj.elements[i].factor); } indices[0] = 0; for (int var = 0; var != n; ++var) { indices[var + 1] = indices[var]; for (int i = 0, e = length(obj.qelements); i != e; ++i) { bx_ensures(0 <= obj.qelements[i].variable_index_a && obj.qelements[i].variable_index_a < n); bx_ensures(0 <= obj.qelements[i].variable_index_b && obj.qelements[i].variable_index_b < n); if (var == obj.qelements[i].variable_index_a || var == obj.qelements[i].variable_index_b) ++indices[var + 1]; } } for (int id = 0, var = 0; var != n; ++var) { for (int i = 0, e = length(obj.qelements); i != e; ++i) { const bool is_a = obj.qelements[i].variable_index_a == var; const bool is_b = obj.qelements[i].variable_index_b == var; if (is_a || is_b) { quadratic_elements[id].factor = static_cast<Float>(obj.qelements[i].factor); quadratic_elements[id].id = is_a ? obj.qelements[i].variable_index_b : obj.qelements[i].variable_index_a; ++id; } } } }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx pushq %rax movq %rsi, (%rdi) leaq 0x8(%rdi), %r15 movslq %edx, %rsi movq %rdi, %r13 movl %edx, %ebx movq %r15, %rdi callq 0x2900a movq (%r13), %rax leaq 0x10(%r13), %r14 movq 0x20(%rax), %rsi subq 0x18(%rax), %rsi sarq $0x3, %rsi orq $0x1, %rsi movq %r14, %rdi callq 0x6d8f9 leal 0x1(%rbx), %eax leaq 0x18(%r13), %r12 movslq %eax, %rsi movq %r12, %rdi callq 0x28eb6 movq (%r13), %rax movq 0x8(%r13), %rdx movabsq $0xffffffff0, %rcx # imm = 0xFFFFFFFF0 xorl %r8d, %r8d movq (%rax), %rsi movq 0x8(%rax), %rdi subq %rsi, %rdi andq %rcx, %rdi cmpq %r8, %rdi je 0x6d5d0 movslq 0x8(%rsi,%r8), %r9 testq %r9, %r9 js 0x6d6fe cmpl %ebx, %r9d jge 0x6d6fe vmovsd (%rsi,%r8), %xmm0 addq $0x10, %r8 vaddsd (%rdx,%r9,8), %xmm0, %xmm0 vmovsd %xmm0, (%rdx,%r9,8) jmp 0x6d59c movq (%r12), %rdx movl %ebx, %esi xorl %edi, %edi xorl %r8d, %r8d andl $0x0, (%rdx) cmpq %rsi, %r8 je 0x6d64b movl %edi, 0x4(%rdx,%r8,4) leaq 0x1(%r8), %r9 xorl %r15d, %r15d movq 0x18(%rax), %r10 movq 0x20(%rax), %r11 subq %r10, %r11 andq %rcx, %r11 cmpq %r15, %r11 je 0x6d646 movslq 0x8(%r10,%r15), %r12 testq %r12, %r12 js 0x6d6bc cmpl %ebx, %r12d jge 0x6d6bc movslq 0xc(%r10,%r15), %r13 testq %r13, %r13 js 0x6d6dd cmpl %ebx, %r13d jae 0x6d6dd cmpq %r12, %r8 je 0x6d63a cmpq %r13, %r8 jne 0x6d640 incl %edi movl %edi, (%rdx,%r9,4) addq $0x10, %r15 jmp 0x6d5fd movq %r9, %r8 jmp 0x6d5de xorl %edx, %edx xorl %esi, %esi cmpl %ebx, %esi je 0x6d6ad movq 0x18(%rax), %rdi movq 0x20(%rax), %r8 movq (%r14), %r9 xorl %r10d, %r10d subq %rdi, %r8 andq %rcx, %r8 cmpq %r10, %r8 je 0x6d6a9 movl 0x8(%rdi,%r10), %r11d movl 0xc(%rdi,%r10), %ebp cmpl %esi, %r11d je 0x6d67f cmpl %esi, %ebp jne 0x6d6a3 vmovsd (%rdi,%r10), %xmm0 movslq %edx, %rdx movq %rdx, %r15 shlq $0x4, %r15 cmpl %esi, %r11d cmovnel %r11d, %ebp incl %edx vmovsd %xmm0, (%r9,%r15) movl %ebp, 0x8(%r9,%r15) addq $0x10, %r10 jmp 0x6d667 incl %esi jmp 0x6d64f addq $0x8, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq leaq 0x3ead67(%rip), %rdi # 0x45842a leaq 0x3ecfc8(%rip), %rsi # 0x45a692 leaq 0x3ec8bb(%rip), %rdx # 0x459f8c leaq 0x3ed00a(%rip), %rcx # 0x45a6e2 callq 0x2813f leaq 0x3ead46(%rip), %rdi # 0x45842a leaq 0x3ecffc(%rip), %rsi # 0x45a6e7 leaq 0x3ec89a(%rip), %rdx # 0x459f8c leaq 0x3ed03e(%rip), %rcx # 0x45a737 callq 0x2813f leaq 0x3ead25(%rip), %rdi # 0x45842a leaq 0x3ecf37(%rip), %rsi # 0x45a643 leaq 0x3ec879(%rip), %rdx # 0x459f8c leaq 0x3ecf73(%rip), %rcx # 0x45a68d callq 0x2813f movq %r14, %rdi movq %rax, %rbx callq 0x6d93a jmp 0x6d72f movq %rax, %rbx movq %r15, %rdi callq 0x29066 movq %rbx, %rdi callq 0xb3d0 nop
/quesnel[P]baryonyx/lib/src/itm-common.hpp
void baryonyx::itm::init_with_bastert<baryonyx::itm::quadratic_cost_type<double>, baryonyx::itm::maximize_tag>(baryonyx::bit_array&, baryonyx::itm::quadratic_cost_type<double> const&, int, int)
void init_with_bastert(bit_array& x, const Cost& c, const int variables, const int value_if_0) noexcept { for (int i = 0; i != variables; ++i) if (init_x<Mode>(c[i], value_if_0)) x.set(i); else x.unset(i); }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx pushq %rax movl %ecx, %ebx movl %edx, %ebp movq %rsi, %r14 movq %rdi, %r15 xorl %r12d, %r12d cmpl %r12d, %ebp je 0x6ddc5 testl %ebx, %ebx movq %r14, %rdi movl %r12d, %esi setne %r13b callq 0x6e256 vxorpd %xmm1, %xmm1, %xmm1 vucomisd %xmm1, %xmm0 setnp %cl sete %al vucomisd %xmm1, %xmm0 ja 0x6ddb5 andb %cl, %al andb %al, %r13b jne 0x6ddb5 movq %r15, %rdi movl %r12d, %esi callq 0x36a06 jmp 0x6ddc0 movq %r15, %rdi movl %r12d, %esi callq 0x369c8 incl %r12d jmp 0x6dd77 addq $0x8, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::itm::quadratic_cost_type<double>::results(baryonyx::bit_array const&, double) const
double results(const bit_array& x, double cost_constant) const noexcept { for (int i = 0, e = length(obj.elements); i != e; ++i) if (x[obj.elements[i].variable_index]) cost_constant += obj.elements[i].factor; for (int i = 0, e = length(obj.qelements); i != e; ++i) if (x[obj.qelements[i].variable_index_a] && x[obj.qelements[i].variable_index_b]) cost_constant += obj.qelements[i].factor; return cost_constant; }
pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x10, %rsp movq (%rdi), %rax movabsq $0xffffffff0, %r12 # imm = 0xFFFFFFFF0 vmovsd %xmm0, 0x8(%rsp) movq %rsi, %rbx movq %rdi, %r14 xorl %r13d, %r13d movq 0x8(%rax), %r15 subq (%rax), %r15 andq %r12, %r15 movq (%r14), %rax cmpq %r13, %r15 je 0x6e103 movq (%rax), %rax movq %rbx, %rdi movl 0x8(%rax,%r13), %esi callq 0x3664a testl %eax, %eax je 0x6e0fd movq (%r14), %rax vmovsd 0x8(%rsp), %xmm0 movq (%rax), %rax vaddsd (%rax,%r13), %xmm0, %xmm0 vmovsd %xmm0, 0x8(%rsp) addq $0x10, %r13 jmp 0x6e0c9 movq 0x20(%rax), %r15 subq 0x18(%rax), %r15 andq %r12, %r15 xorl %r12d, %r12d cmpq %r12, %r15 je 0x6e165 movq (%r14), %rax movq %rbx, %rdi movq 0x18(%rax), %rax movl 0x8(%rax,%r12), %esi callq 0x3664a testl %eax, %eax je 0x6e15f movq (%r14), %rax movq %rbx, %rdi movq 0x18(%rax), %rax movl 0xc(%rax,%r12), %esi callq 0x3664a testl %eax, %eax je 0x6e15f movq (%r14), %rax vmovsd 0x8(%rsp), %xmm0 movq 0x18(%rax), %rax vaddsd (%rax,%r12), %xmm0, %xmm0 vmovsd %xmm0, 0x8(%rsp) addq $0x10, %r12 jmp 0x6e111 vmovsd 0x8(%rsp), %xmm0 addq $0x10, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 retq nop
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::itm::storage<baryonyx::itm::quadratic_cost_type<double>, baryonyx::itm::maximize_tag>::sort()
void sort() noexcept { m_indices_writer lock{ m_indices_mutex }; std::sort( std::begin(m_indices), std::end(m_indices), [this](int i1, int i2) { const int cst_1 = this->m_data[i1].remaining_constraints; const int cst_2 = this->m_data[i2].remaining_constraints; const double value_1 = this->m_data[i1].value; const double value_2 = this->m_data[i2].value; if (cst_1 < cst_2) return true; if (cst_1 == cst_2) return is_better_solution<Mode>(value_1, value_2); return false; }); #ifdef BARYONYX_ENABLE_DEBUG to_log(stdout, 3u, "- Solutions init population:\n"); for (int i = 0; i != m_size; ++i) { to_log(stdout, 5u, "- {} id {} value {} constraint {} hash {}\n", i, m_indices[i], m_data[m_indices[i]].value, m_data[m_indices[i]].remaining_constraints, m_data[m_indices[i]].hash); } #endif }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x18, %rsp movq %rdi, %rbx leaq 0x8(%rsp), %rdi movq %rbx, %rsi callq 0x377e6 movq 0x38(%rbx), %rdi movq 0x40(%rbx), %rsi movq %rbx, %rdx callq 0x6ecf9 movq 0x5cee19(%rip), %r13 # 0x63cfc8 movq (%r13), %rdi leaq 0x3ebede(%rip), %rcx # 0x45a098 pushq $0x3 popq %rsi pushq $0x1d popq %rdx callq 0x377fc leaq 0x3ebeea(%rip), %r14 # 0x45a0b6 xorl %eax, %eax pushq $0x5 popq %rbp pushq $0x2a popq %r15 leaq 0x4(%rsp), %r12 movl %eax, 0x4(%rsp) cmpl 0x98(%rbx), %eax je 0x6e233 movq 0x38(%rbx), %rcx cltq movq 0x50(%rbx), %rdx movq (%r13), %rdi leaq (%rcx,%rax,4), %r9 movslq (%r9), %rax imulq $0x38, %rax, %rax leaq 0x10(%rdx,%rax), %r10 leaq 0x30(%rdx,%rax), %r11 leaq 0x20(%rdx,%rax), %rax subq $0x8, %rsp movq %r15, %rdx movl %ebp, %esi movq %r14, %rcx movq %r12, %r8 pushq %rax pushq %r11 pushq %r10 callq 0x3783f addq $0x20, %rsp movl 0x4(%rsp), %eax incl %eax jmp 0x6e1da leaq 0x8(%rsp), %rdi callq 0x378b4 addq $0x18, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq jmp 0x6e24e movq %rax, %rdi callq 0xeb9f
/quesnel[P]baryonyx/lib/src/itm-optimizer-common.hpp
baryonyx::itm::quadratic_cost_type<double> baryonyx::itm::normalize_costs<double, baryonyx::itm::quadratic_cost_type<double>>(baryonyx::context const&, baryonyx::itm::quadratic_cost_type<double> const&, std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>&, int)
inline Cost normalize_costs(const context& ctx, const Cost& c, random_engine& rng, int n) { Cost ret(c, n); switch (ctx.parameters.cost_norm) { case solver_parameters::cost_norm_type::none: info(ctx, " - No norm"); return ret; case solver_parameters::cost_norm_type::random: info(ctx, " - Compute random norm\n"); ret.make_random_norm(n, rng); return ret; case solver_parameters::cost_norm_type::l1: info(ctx, " - Compute l1 norm\n"); ret.make_l1_norm(n); return ret; case solver_parameters::cost_norm_type::l2: info(ctx, " - Compute l2 norm\n"); ret.make_l2_norm(n); return ret; default: info(ctx, " - Compute infinity-norm (default)\n"); ret.make_loo_norm(n); return ret; } }
pushq %rbp pushq %r15 pushq %r14 pushq %rbx pushq %rax movq %rsi, %r14 movq %rdx, %rsi movl %r8d, %edx movl %r8d, %ebp movq %rcx, %r15 movq %rdi, %rbx callq 0x7058a movl 0xd8(%r14), %eax cmpq $0x3, %rax ja 0x6fbf7 leaq 0x3ea0c7(%rip), %rcx # 0x459c50 movslq (%rcx,%rax,4), %rax addq %rcx, %rax jmpq *%rax leaq 0x3ea54e(%rip), %rsi # 0x45a0e7 movq %r14, %rdi callq 0x348e9 jmp 0x6fc10 leaq 0x3ea562(%rip), %rsi # 0x45a10c movq %r14, %rdi callq 0x348e9 movq %rbx, %rdi movl %ebp, %esi callq 0x70848 jmp 0x6fc10 leaq 0x3ea55c(%rip), %rsi # 0x45a121 movq %r14, %rdi callq 0x348e9 movq %rbx, %rdi movl %ebp, %esi callq 0x70900 jmp 0x6fc10 leaq 0x3ea513(%rip), %rsi # 0x45a0f3 movq %r14, %rdi callq 0x348e9 movq %rbx, %rdi movl %ebp, %esi movq %r15, %rdx callq 0x7066c jmp 0x6fc10 leaq 0x3ea538(%rip), %rsi # 0x45a136 movq %r14, %rdi callq 0x348e9 movq %rbx, %rdi movl %ebp, %esi callq 0x709aa movq %rbx, %rax addq $0x8, %rsp popq %rbx popq %r14 popq %r15 popq %rbp retq movq %rbx, %rdi movq %rax, %r14 callq 0x6d8d6 movq %r14, %rdi callq 0xb3d0
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::itm::solver_random_inequalities_101coeff<double, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<double>>::solver_random_inequalities_101coeff(std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>&, int, int, baryonyx::itm::quadratic_cost_type<double> const&, std::vector<baryonyx::itm::merged_constraint, std::allocator<baryonyx::itm::merged_constraint>> const&)
solver_random_inequalities_101coeff( random_engine& rng_, int m_, int n_, const cost_type& c_, const std::vector<merged_constraint>& csts) : rng(rng_) , ap(csts, m_, n_) , A(std::make_unique<int[]>(ap.size())) , R(std::make_unique<rc_data[]>(compute_reduced_costs_vector_size(csts))) , b(std::make_unique<bound_factor[]>(m_)) , pi(std::make_unique<Float[]>(m_)) , P(std::make_unique<Float[]>(ap.size())) , c(c_) , dist(0.5) , m(m_) , n(n_) { int id = 0; for (int i = 0, e = length(csts); i != e; ++i) { int lower = 0, upper = 0; for (const auto& cst : csts[i].elements) { bx_ensures(std::abs(cst.factor) == 1); A[id++] = cst.factor; if (cst.factor > 0) upper++; else lower++; } if (csts[i].min == csts[i].max) { b[i].min = csts[i].min; b[i].max = csts[i].max; } else { b[i].min = std::max(-lower, csts[i].min); b[i].max = std::min(upper, csts[i].max); } bx_ensures(b[i].min <= b[i].max); } }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x28, %rsp leaq 0x8(%rdi), %r13 movq %rsi, (%rdi) movq %rdi, %r15 movq %r9, %r12 movq %r8, 0x20(%rsp) movl %edx, %r14d movq %r9, %rsi movl %ecx, 0x4(%rsp) movq %r13, %rdi callq 0x3a4ca movl 0x30(%r15), %esi leaq 0x48(%r15), %rbx movq %rbx, %rdi movq %r13, 0x18(%rsp) callq 0x28eb6 movq %r12, %rdi leaq 0x50(%r15), %rbp callq 0x3a89d movq %rbp, 0x10(%rsp) movq %rbp, %rdi movq %rax, %rsi callq 0x7163e movslq %r14d, %rbp leaq 0x58(%r15), %rdi movq %rbp, %rsi movq %rdi, 0x8(%rsp) callq 0x7167e leaq 0x60(%r15), %r13 movq %r13, %rdi movq %rbp, %rsi callq 0x2900a movl 0x30(%r15), %esi leaq 0x68(%r15), %rdi callq 0x2900a movq 0x20(%rsp), %rax movq %rax, 0x70(%r15) movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000 movq %rax, 0x78(%r15) movl 0x4(%rsp), %eax movl %r14d, 0x80(%r15) movl %eax, 0x84(%r15) movq (%r12), %rcx movq 0x8(%r12), %rax subq %rcx, %rax pushq $0x28 popq %rsi cqto xorl %edi, %edi idivq %rsi movq 0x58(%r15), %rdx xorl %esi, %esi movl %eax, %eax cmpq %rax, %rsi je 0x6fe54 imulq $0x28, %rsi, %r8 movq (%rbx), %r15 movslq %edi, %rdi xorl %r10d, %r10d movq (%rcx,%r8), %r11 movq 0x8(%rcx,%r8), %r14 leaq (%rcx,%r8), %r9 xorl %r8d, %r8d cmpq %r14, %r11 je 0x6fde7 movl (%r11), %r12d leal 0x1(%r12), %ebp testl $0xfffffffd, %ebp # imm = 0xFFFFFFFD jne 0x6fe63 movl %r12d, (%r15,%rdi,4) incq %rdi xorl %ebp, %ebp xorl %r12d, %r12d cmpl $0x0, (%r11) setle %bpl setg %r12b addq $0x8, %r11 addl %r12d, %r10d addl %ebp, %r8d jmp 0x6fdaa movl 0x18(%r9), %r11d cmpl 0x1c(%r9), %r11d jne 0x6fdfe imulq $0xc, %rsi, %r8 movl %r11d, (%rdx,%r8) movl %r11d, %r8d jmp 0x6fe1e negl %r8d cmpl %r8d, %r11d cmovgl %r11d, %r8d imulq $0xc, %rsi, %r11 movl %r8d, (%rdx,%r11) movl 0x1c(%r9), %r9d cmpl %r10d, %r9d cmovll %r9d, %r10d movl %r10d, %r11d imulq $0xc, %rsi, %r9 incq %rsi movl %r11d, 0x4(%rdx,%r9) cmpl %r11d, %r8d jle 0x6fd84 leaq 0x3e85f0(%rip), %rdi # 0x45842a leaq 0x3ea468(%rip), %rsi # 0x45a2a9 leaq 0x3ea3ff(%rip), %rdx # 0x45a247 leaq 0x3ea46f(%rip), %rcx # 0x45a2be callq 0x2813f addq $0x28, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq leaq 0x3e85c0(%rip), %rdi # 0x45842a leaq 0x3ea3bc(%rip), %rsi # 0x45a22d leaq 0x3ea3cf(%rip), %rdx # 0x45a247 leaq 0x3ea427(%rip), %rcx # 0x45a2a6 callq 0x2813f movq %r13, %rdi movq %rax, %r14 callq 0x29066 jmp 0x6fe94 movq %rax, %r14 movq 0x8(%rsp), %rdi callq 0x716bc jmp 0x6fea3 movq %rax, %r14 movq 0x10(%rsp), %rdi callq 0x716d6 jmp 0x6feb2 movq %rax, %r14 movq %rbx, %rdi callq 0x28fb6 jmp 0x6febf movq %rax, %r14 movq 0x18(%rsp), %rdi callq 0x3a954 movq %r14, %rdi callq 0xb3d0 nop
/quesnel[P]baryonyx/lib/src/random-solver.cpp
void baryonyx::itm::compute_order::init<baryonyx::itm::solver_random_inequalities_101coeff<double, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<double>>, baryonyx::bit_array>(baryonyx::itm::solver_random_inequalities_101coeff<double, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<double>> const&, baryonyx::bit_array const&)
void init(const Solver& s, const Xtype& x) { switch (order) { case solver_parameters::constraint_order::infeasibility_decr: case solver_parameters::constraint_order::infeasibility_incr: infeasibility_local_compute_violated_constraints(s, x); break; case solver_parameters::constraint_order::pi_sign_change: std::iota(R.begin(), R.end(), 0); break; case solver_parameters::constraint_order::none: case solver_parameters::constraint_order::reversing: case solver_parameters::constraint_order::random_sorting: case solver_parameters::constraint_order::lagrangian_decr: case solver_parameters::constraint_order::lagrangian_incr: default: compute_violated_constraints(s, x, R); break; } }
movl 0x30(%rdi), %ecx movq %rdi, %rax leal -0x3(%rcx), %edi cmpl $0x2, %edi jae 0x6ffe8 movq %rax, %rdi jmp 0x71b60 cmpl $0x7, %ecx jne 0x70005 movq (%rax), %rcx movq 0x8(%rax), %rax xorl %edx, %edx cmpq %rax, %rcx je 0x70013 movl %edx, (%rcx) incl %edx addq $0x4, %rcx jmp 0x6fff6 movq %rsi, %rdi movq %rdx, %rsi movq %rax, %rdx jmp 0x71c62 retq
/quesnel[P]baryonyx/lib/src/itm-common.hpp
int baryonyx::itm::compute_order::run<baryonyx::itm::solver_random_inequalities_101coeff<double, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<double>>, baryonyx::bit_array, double>(baryonyx::itm::solver_random_inequalities_101coeff<double, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<double>>&, baryonyx::bit_array&, std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>&, double, double, double)
int run(Solver& solver, Xtype& x, random_engine& rng, Float kappa, Float delta, Float theta) { bool pi_changed = false; int remaining = 0; switch (order) { case solver_parameters::constraint_order::reversing: solver.compute_update_row( x, R.crbegin(), R.crend(), kappa, delta, theta); return compute_violated_constraints(solver, x, R); case solver_parameters::constraint_order::random_sorting: std::shuffle(R.begin(), R.end(), rng); solver.compute_update_row( x, R.begin(), R.end(), kappa, delta, theta); return compute_violated_constraints(solver, x, R); case solver_parameters::constraint_order::infeasibility_decr: std::sort(m_order.begin(), m_order.end(), [](const auto& lhs, const auto& rhs) { return rhs.second < lhs.second; }); solver.compute_update_row( x, m_order.cbegin(), m_order.cend(), kappa, delta, theta); return infeasibility_local_compute_violated_constraints(solver, x); case solver_parameters::constraint_order::infeasibility_incr: std::sort(m_order.begin(), m_order.end(), [](const auto& lhs, const auto& rhs) { return lhs.second < rhs.second; }); solver.compute_update_row( x, m_order.cbegin(), m_order.cend(), kappa, delta, theta); return infeasibility_local_compute_violated_constraints(solver, x); case solver_parameters::constraint_order::lagrangian_decr: std::sort( R.begin(), R.end(), [&solver](const auto lhs, const auto rhs) { return solver.pi[rhs] < solver.pi[lhs]; }); solver.compute_update_row( x, R.cbegin(), R.cend(), kappa, delta, theta); return compute_violated_constraints(solver, x, R); case solver_parameters::constraint_order::lagrangian_incr: std::sort( R.begin(), R.end(), [&solver](const auto lhs, const auto rhs) { return solver.pi[lhs] < solver.pi[rhs]; }); solver.compute_update_row( x, R.cbegin(), R.cend(), kappa, delta, theta); return compute_violated_constraints(solver, x, R); case solver_parameters::constraint_order::pi_sign_change: std::shuffle(R.begin(), R.end(), rng); pi_changed = solver.compute_update_row( x, R.begin(), R.end(), kappa, delta, theta); remaining = local_compute_violated_constraints(solver, x); if (!pi_changed && remaining == 0) return 0; return remaining; case solver_parameters::constraint_order::none: default: solver.compute_update_row( x, R.begin(), R.end(), kappa, delta, theta); return compute_violated_constraints(solver, x, R); } }
pushq %r15 pushq %r14 pushq %rbx subq $0x30, %rsp movl 0x30(%rdi), %eax movq %rdx, %rbx movq %rsi, %r15 movq %rdi, %r14 decl %eax cmpl $0x6, %eax ja 0x70153 leaq 0x3e9c25(%rip), %rdx # 0x459c60 movslq (%rdx,%rax,4), %rax addq %rdx, %rax jmpq *%rax movq 0x8(%r14), %rax leaq 0x28(%rsp), %rdx leaq 0x20(%rsp), %rcx movq %r15, %rdi movq %rbx, %rsi movq %rax, (%rdx) movq (%r14), %rax movq %rax, (%rcx) callq 0x71d58 movq %r15, %rdi movq %rbx, %rsi movq %r14, %rdx callq 0x71c62 addq $0x30, %rsp popq %rbx popq %r14 popq %r15 retq movq (%r14), %rdi movq 0x8(%r14), %rsi movq %r15, %rdx vmovsd %xmm2, 0x18(%rsp) vmovsd %xmm1, 0x10(%rsp) vmovsd %xmm0, 0x8(%rsp) callq 0x740e7 jmp 0x70188 movq 0x18(%r14), %rdi movq 0x20(%r14), %rsi vmovsd %xmm2, 0x18(%rsp) vmovsd %xmm1, 0x10(%rsp) vmovsd %xmm0, 0x8(%rsp) callq 0x73811 jmp 0x700e4 movq 0x18(%r14), %rdi movq 0x20(%r14), %rsi vmovsd %xmm2, 0x18(%rsp) vmovsd %xmm1, 0x10(%rsp) vmovsd %xmm0, 0x8(%rsp) callq 0x73c7c vmovsd 0x8(%rsp), %xmm0 vmovsd 0x10(%rsp), %xmm1 vmovsd 0x18(%rsp), %xmm2 movq 0x18(%r14), %rdx movq 0x20(%r14), %rcx movq %r15, %rdi movq %rbx, %rsi callq 0x72642 movq %r14, %rdi movq %r15, %rsi movq %rbx, %rdx addq $0x30, %rsp popq %rbx popq %r14 popq %r15 jmp 0x72ab2 movq (%r14), %rdi movq 0x8(%r14), %rsi movq %rcx, %rdx vmovsd %xmm2, 0x18(%rsp) vmovsd %xmm1, 0x10(%rsp) vmovsd %xmm0, 0x8(%rsp) callq 0x3ceed vmovsd 0x8(%rsp), %xmm0 vmovsd 0x10(%rsp), %xmm1 vmovsd 0x18(%rsp), %xmm2 movq (%r14), %rdx movq 0x8(%r14), %rcx movq %r15, %rdi movq %rbx, %rsi callq 0x721d2 jmp 0x701ac movq (%r14), %rdi movq 0x8(%r14), %rsi movq %r15, %rdx vmovsd %xmm2, 0x18(%rsp) vmovsd %xmm1, 0x10(%rsp) vmovsd %xmm0, 0x8(%rsp) callq 0x745d9 vmovsd 0x8(%rsp), %xmm0 vmovsd 0x10(%rsp), %xmm1 vmovsd 0x18(%rsp), %xmm2 movq (%r14), %rdx movq 0x8(%r14), %rcx movq %r15, %rdi movq %rbx, %rsi callq 0x72bb4 movq %r15, %rdi movq %rbx, %rsi movq %r14, %rdx addq $0x30, %rsp popq %rbx popq %r14 popq %r15 jmp 0x71c62 movq (%r14), %rdi movq 0x8(%r14), %rsi movq %rcx, %rdx vmovsd %xmm2, 0x18(%rsp) vmovsd %xmm1, 0x10(%rsp) vmovsd %xmm0, 0x8(%rsp) callq 0x3ceed vmovsd 0x8(%rsp), %xmm0 vmovsd 0x10(%rsp), %xmm1 vmovsd 0x18(%rsp), %xmm2 movq (%r14), %rdx movq 0x8(%r14), %rcx movq %r15, %rdi movq %rbx, %rsi callq 0x721d2 movq %r14, %rdi movq %r15, %rsi movq %rbx, %rdx addq $0x30, %rsp popq %rbx popq %r14 popq %r15 jmp 0x73024 nop
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::itm::best_solution_recorder<baryonyx::itm::quadratic_cost_type<double>, double, baryonyx::itm::maximize_tag>::try_update(baryonyx::itm::local_context&, baryonyx::bit_array const&, double, long)
void try_update(local_context& ctx, const bit_array& solution, const double value, const long int loop) { auto hash = bit_array_hash()(solution); if (m_storage.can_be_inserted(hash, value)) { const auto end = std::chrono::steady_clock::now(); const auto duration = compute_duration(m_start, end); m_storage.insert(ctx, solution, hash, value, duration, loop); } }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x18, %rsp movq %rdi, %r13 leaq 0xf(%rsp), %rdi movq %rsi, %r15 movq %rdx, %rsi movq %rcx, %rbx vmovsd %xmm0, 0x10(%rsp) movq %rdx, %r14 callq 0x3775a vmovsd 0x10(%rsp), %xmm0 leaq 0x8(%r13), %rbp movq %rax, %r12 movq %rax, %rsi movq %rbp, %rdi callq 0x74ad0 testb %al, %al je 0x70299 callq 0xb5a0 subq (%r13), %rax movq %rbp, %rdi movq %r15, %rsi movq %r14, %rdx movq %r12, %rcx movq %rbx, %r8 vcvtsi2sd %rax, %xmm1, %xmm0 vdivsd 0x3e97f2(%rip), %xmm0, %xmm1 # 0x459a80 vmovsd 0x10(%rsp), %xmm0 callq 0x74b50 addq $0x18, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq
/quesnel[P]baryonyx/lib/src/itm-optimizer-common.hpp
baryonyx::itm::best_solution_recorder<baryonyx::itm::quadratic_cost_type<double>, double, baryonyx::itm::maximize_tag>::try_advance(baryonyx::itm::local_context&, baryonyx::bit_array const&, int, long)
void try_advance(local_context& ctx, const bit_array& solution, const int remaining_constraints, const long int loop) { auto hash = bit_array_hash()(solution); if (m_storage.can_be_inserted(hash, remaining_constraints)) { const auto end = std::chrono::steady_clock::now(); const auto duration = compute_duration(m_start, end); m_storage.insert( ctx, solution, hash, remaining_constraints, duration, loop); } }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x18, %rsp movq %rdi, %r13 leaq 0xf(%rsp), %rdi movq %rsi, %r15 movq %rdx, %rsi movq %r8, 0x10(%rsp) movl %ecx, %ebp movq %rdx, %r14 callq 0x3775a leaq 0x8(%r13), %rbx movq %rax, %r12 movq %rax, %rsi movl %ebp, %edx movq %rbx, %rdi callq 0x74cd0 testb %al, %al je 0x7031a callq 0xb5a0 subq (%r13), %rax movq 0x10(%rsp), %r9 movq %rbx, %rdi movq %r15, %rsi movq %r14, %rdx movq %r12, %rcx movl %ebp, %r8d vcvtsi2sd %rax, %xmm0, %xmm0 vdivsd 0x3e976b(%rip), %xmm0, %xmm0 # 0x459a80 callq 0x74d3a addq $0x18, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq nop
/quesnel[P]baryonyx/lib/src/itm-optimizer-common.hpp
int baryonyx::itm::compute_order::push_and_run<baryonyx::itm::solver_random_inequalities_101coeff<double, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<double>>, baryonyx::bit_array, double>(baryonyx::itm::solver_random_inequalities_101coeff<double, baryonyx::itm::maximize_tag, baryonyx::itm::quadratic_cost_type<double>>&, baryonyx::bit_array&, std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>&, double, double, double, double)
int push_and_run(Solver& solver, Xtype& x, random_engine& rng, Float kappa, Float delta, Float theta, Float objective_amplifier) { bool pi_changed = 0; int remaining = 0; if (use_cycle) order = next_state(order); switch (order) { case solver_parameters::constraint_order::reversing: solver.push_and_compute_update_row(x, R.crbegin(), R.crend(), kappa, delta, theta, objective_amplifier); return compute_violated_constraints(solver, x, R); case solver_parameters::constraint_order::random_sorting: std::shuffle(R.begin(), R.end(), rng); solver.push_and_compute_update_row( x, R.begin(), R.end(), kappa, delta, theta, objective_amplifier); return compute_violated_constraints(solver, x, R); case solver_parameters::constraint_order::infeasibility_decr: std::sort(m_order.begin(), m_order.end(), [](const auto& lhs, const auto& rhs) { return rhs.second < lhs.second; }); solver.push_and_compute_update_row(x, m_order.cbegin(), m_order.cend(), kappa, delta, theta, objective_amplifier); return infeasibility_local_compute_violated_constraints(solver, x); case solver_parameters::constraint_order::infeasibility_incr: std::sort(m_order.begin(), m_order.end(), [](const auto& lhs, const auto& rhs) { return lhs.second < rhs.second; }); solver.push_and_compute_update_row(x, m_order.cbegin(), m_order.cend(), kappa, delta, theta, objective_amplifier); return infeasibility_local_compute_violated_constraints(solver, x); case solver_parameters::constraint_order::lagrangian_decr: std::sort( R.begin(), R.end(), [&solver](const auto lhs, const auto rhs) { return solver.pi[rhs] < solver.pi[lhs]; }); solver.push_and_compute_update_row(x, R.cbegin(), R.cend(), kappa, delta, theta, objective_amplifier); return compute_violated_constraints(solver, x, R); case solver_parameters::constraint_order::lagrangian_incr: std::sort( R.begin(), R.end(), [&solver](const auto lhs, const auto rhs) { return solver.pi[lhs] < solver.pi[rhs]; }); solver.push_and_compute_update_row(x, R.cbegin(), R.cend(), kappa, delta, theta, objective_amplifier); return compute_violated_constraints(solver, x, R); case solver_parameters::constraint_order::pi_sign_change: std::shuffle(R.begin(), R.end(), rng); pi_changed = solver.push_and_compute_update_row( x, R.begin(), R.end(), kappa, delta, theta, objective_amplifier); remaining = local_compute_violated_constraints(solver, x); if (!pi_changed && remaining == 0) return 0; return remaining; case solver_parameters::constraint_order::none: default: solver.push_and_compute_update_row(x, R.cbegin(), R.cend(), kappa, delta, theta, objective_amplifier); return compute_violated_constraints(solver, x, R); } }
pushq %r15 pushq %r14 pushq %rbx subq $0x30, %rsp movl 0x30(%rdi), %eax cmpb $0x1, 0x34(%rdi) movq %rdx, %rbx movq %rsi, %r15 movq %rdi, %r14 jne 0x70356 xorl %esi, %esi leal 0x1(%rax), %edx cmpl $0x7, %eax cmovll %edx, %esi movl %esi, %eax movl %esi, 0x30(%r14) decl %eax cmpl $0x6, %eax ja 0x704c7 leaq 0x3e9914(%rip), %rdx # 0x459c7c movslq (%rdx,%rax,4), %rax addq %rdx, %rax jmpq *%rax movq 0x8(%r14), %rax leaq 0x28(%rsp), %rdx leaq 0x20(%rsp), %rcx movq %r15, %rdi movq %rbx, %rsi movq %rax, (%rdx) movq (%r14), %rax movq %rax, (%rcx) callq 0x74e3a movq %r15, %rdi movq %rbx, %rsi movq %r14, %rdx callq 0x71c62 addq $0x30, %rsp popq %rbx popq %r14 popq %r15 retq movq (%r14), %rdi movq 0x8(%r14), %rsi movq %r15, %rdx vmovsd %xmm2, 0x18(%rsp) vmovsd %xmm1, 0x10(%rsp) vmovsd %xmm0, 0x8(%rsp) callq 0x75734 jmp 0x704b5 movq 0x18(%r14), %rdi movq 0x20(%r14), %rsi vmovsd %xmm2, 0x18(%rsp) vmovsd %xmm1, 0x10(%rsp) vmovsd %xmm0, 0x8(%rsp) callq 0x74e5e jmp 0x70411 movq 0x18(%r14), %rdi movq 0x20(%r14), %rsi vmovsd %xmm2, 0x18(%rsp) vmovsd %xmm1, 0x10(%rsp) vmovsd %xmm0, 0x8(%rsp) callq 0x752c9 vmovsd 0x8(%rsp), %xmm0 vmovsd 0x10(%rsp), %xmm1 vmovsd 0x18(%rsp), %xmm2 movq 0x18(%r14), %rdx movq 0x20(%r14), %rcx movq %r15, %rdi movq %rbx, %rsi callq 0x72642 movq %r14, %rdi movq %r15, %rsi movq %rbx, %rdx addq $0x30, %rsp popq %rbx popq %r14 popq %r15 jmp 0x72ab2 movq (%r14), %rdi movq 0x8(%r14), %rsi movq %rcx, %rdx vmovsd %xmm2, 0x18(%rsp) vmovsd %xmm1, 0x10(%rsp) vmovsd %xmm0, 0x8(%rsp) callq 0x3ceed vmovsd 0x8(%rsp), %xmm0 vmovsd 0x10(%rsp), %xmm1 vmovsd 0x18(%rsp), %xmm2 movq (%r14), %rdx movq 0x8(%r14), %rcx movq %r15, %rdi movq %rbx, %rsi callq 0x721d2 jmp 0x704d9 movq (%r14), %rdi movq 0x8(%r14), %rsi movq %r15, %rdx vmovsd %xmm2, 0x18(%rsp) vmovsd %xmm1, 0x10(%rsp) vmovsd %xmm0, 0x8(%rsp) callq 0x75c26 vmovsd 0x8(%rsp), %xmm0 vmovsd 0x10(%rsp), %xmm1 vmovsd 0x18(%rsp), %xmm2 movq (%r14), %rdx movq 0x8(%r14), %rcx movq %r15, %rdi movq %rbx, %rsi callq 0x72bb4 movq %r15, %rdi movq %rbx, %rsi movq %r14, %rdx addq $0x30, %rsp popq %rbx popq %r14 popq %r15 jmp 0x71c62 movq (%r14), %rdi movq 0x8(%r14), %rsi movq %rcx, %rdx vmovsd %xmm2, 0x18(%rsp) vmovsd %xmm1, 0x10(%rsp) vmovsd %xmm0, 0x8(%rsp) callq 0x3ceed vmovsd 0x8(%rsp), %xmm0 vmovsd 0x10(%rsp), %xmm1 vmovsd 0x18(%rsp), %xmm2 movq (%r14), %rdx movq 0x8(%r14), %rcx movq %r15, %rdi movq %rbx, %rsi callq 0x721d2 movq %r14, %rdi movq %r15, %rsi movq %rbx, %rdx addq $0x30, %rsp popq %rbx popq %r14 popq %r15 jmp 0x73024
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::itm::quadratic_cost_type<double>::quadratic_cost_type(baryonyx::itm::quadratic_cost_type<double> const&, int)
quadratic_cost_type(const quadratic_cost_type& other, int n) : obj(other.obj) , linear_elements(std::make_unique<Float[]>(n)) , quadratic_elements(std::make_unique<quad[]>(other.indices[n])) , indices(std::make_unique<int[]>(n + 1)) { std::copy_n(other.linear_elements.get(), n, linear_elements.get()); std::copy_n(other.indices.get(), n + 1, indices.get()); std::copy_n(other.quadratic_elements.get(), other.indices[n], quadratic_elements.get()); }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx pushq %rax movq (%rsi), %rax leaq 0x8(%rdi), %r13 movslq %edx, %r15 movq %rsi, %rbx movl %edx, %ebp movq %rdi, %r12 movq %r15, %rsi movq %rax, (%rdi) movq %r13, %rdi callq 0x2900a movq 0x18(%rbx), %rax leaq 0x10(%r12), %rdi movslq (%rax,%r15,4), %rsi movq %rdi, (%rsp) callq 0x6d8f9 leal 0x1(%rbp), %r14d addq $0x18, %r12 movslq %r14d, %rsi movq %r12, %rdi callq 0x28eb6 testl %ebp, %ebp jle 0x705f7 movq (%r13), %rdi movq 0x8(%rbx), %rsi movl %ebp, %edx shlq $0x3, %rdx callq 0xb140 jmp 0x705f9 js 0x7060d movq 0x18(%rbx), %rsi movq (%r12), %rdi movl %r14d, %edx shlq $0x2, %rdx callq 0xb140 movq 0x18(%rbx), %rax movslq (%rax,%r15,4), %rdx testq %rdx, %rdx jle 0x7063c movq (%rsp), %rax movq 0x10(%rbx), %rsi shlq $0x4, %rdx movq (%rax), %rdi addq $0x8, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp jmp 0xb140 addq $0x8, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq movq (%rsp), %rdi movq %rax, %rbx callq 0x6d93a jmp 0x7065c movq %rax, %rbx movq %r13, %rdi callq 0x29066 movq %rbx, %rdi callq 0xb3d0
/quesnel[P]baryonyx/lib/src/itm-common.hpp
void baryonyx::itm::quadratic_cost_type<double>::make_random_norm<std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>>(int, std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>&)
void make_random_norm(int n, Random& rng) { std::vector<std::pair<Float, int>> r(n); std::vector<std::pair<quad, int>> q(indices[n]); for (int i = 0; i != n; ++i) r[i] = { linear_elements[i], i }; std::sort(r.begin(), r.end(), [](const auto& lhs, const auto& rhs) { return lhs.first < rhs.first; }); { auto begin = r.begin(); auto end = r.end(); auto next = r.begin()++; for (; next != end; ++next) { if (next->first != begin->first) { if (std::distance(begin, next) > 1) random_epsilon_unique( begin, next, rng, begin->first, next->first); begin = next; } } if (std::distance(begin, end) > 1) { if (begin == r.begin()) { random_epsilon_unique( begin, end, rng, begin->first, begin->first + 1); } else { auto value = linearize(std::ptrdiff_t(0), r.front().first, std::distance(r.begin(), begin), begin->first, std::distance(r.begin(), r.end())); random_epsilon_unique( begin, end, rng, begin->first, value); } } // Reorder the vector according to the variable index, so, // it restores the initial order. std::sort( r.begin(), r.end(), [](const auto& lhs, const auto& rhs) { return lhs.second < rhs.second; }); } { // auto begin = q.begin(); // auto end = q.end(); // auto next = q.begin()++; // for (; next != end; ++next) { // if (next->first != begin->first) { // if (std::distance(begin, next) > 1) // random_epsilon_unique( // begin, next, rng, begin->first, // next->first); // begin = next; // } // } // if (std::distance(begin, end) > 1) { // if (begin == q.begin()) { // random_epsilon_unique( // begin, end, rng, begin->first, begin->first + // 1); // } else { // auto value = linearize(std::ptrdiff_t(0), // q.front().first, // std::distance(q.begin(), // begin), begin->first, // std::distance(q.begin(), // q.end())); // random_epsilon_unique( // begin, end, rng, begin->first, value); // } // } // Reorder the vector according to the variable index, so, // it restores the initial order. // std::sort( // q.begin(), q.end(), [](const auto& lhs, const auto& // rhs) { // return lhs.second < rhs.second; // }); } for (int i = 0; i != n; ++i) linear_elements[i] = r[i].first; // for (int i = 0; i != n; ++i) { // quadratic_elements[i].factor = r[i].first.factor; // Finally we compute the l+oo norm. make_loo_norm(n); }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x48, %rsp movq %rdx, %r15 movq %rdi, %rbx movslq %esi, %r14 leaq 0x10(%rsp), %rdi leaq 0x30(%rsp), %rdx movl %esi, %ebp movq %r14, %rsi callq 0x656ec movq 0x18(%rbx), %rax movslq (%rax,%r14,4), %rsi leaq 0x30(%rsp), %rdi leaq 0xf(%rsp), %rdx callq 0x70a50 movq 0x10(%rsp), %rcx movq 0x8(%rbx), %rax movl %ebp, %r14d xorl %edx, %edx addq $0x8, %rcx cmpq %rdx, %r14 je 0x706da vmovsd (%rax,%rdx,8), %xmm0 vmovsd %xmm0, -0x8(%rcx) movl %edx, (%rcx) incq %rdx addq $0x10, %rcx jmp 0x706c0 movq 0x10(%rsp), %rdi movq 0x18(%rsp), %rsi movq %rbx, 0x28(%rsp) callq 0x70b9f movq 0x10(%rsp), %rbx movq 0x18(%rsp), %r12 movq %rbx, %rbp movq %rbx, %r13 cmpq %r12, %rbp je 0x70748 vmovsd (%rbp), %xmm1 vmovsd (%r13), %xmm0 vucomisd %xmm0, %xmm1 jne 0x70716 jnp 0x70738 movq %rbx, %rcx subq %r13, %rcx movq %rbp, %rax cmpq $0x11, %rcx jl 0x7073b movq %r13, %rdi movq %rbp, %rsi movq %r15, %rdx callq 0x6573f movq %rbp, %rax jmp 0x7073b movq %r13, %rax addq $0x10, %rbp addq $0x10, %rbx movq %rax, %r13 jmp 0x706fe movq %r12, %rax subq %r13, %rax cmpq $0x11, %rax jl 0x707b8 movq 0x10(%rsp), %rax movq %r13, %rsi subq %rax, %rsi je 0x7079c vmovsd (%rax), %xmm0 vmovsd (%r13), %xmm1 movq 0x18(%rsp), %rdx sarq $0x4, %rsi xorl %edi, %edi subq %rax, %rdx sarq $0x4, %rdx callq 0x657b5 vmovapd %xmm0, %xmm1 vmovsd (%r13), %xmm0 movq %r13, %rdi movq %r12, %rsi movq %r15, %rdx callq 0x6573f jmp 0x707b8 vmovsd (%r13), %xmm0 vaddsd 0x3e388e(%rip), %xmm0, %xmm1 # 0x454038 movq %r13, %rdi movq %r12, %rsi movq %r15, %rdx callq 0x6573f movq 0x10(%rsp), %rdi movq 0x18(%rsp), %rsi callq 0x710b2 movq 0x28(%rsp), %rdi movq 0x10(%rsp), %rax movq %r14, %rdx shlq $0x3, %rdx xorl %esi, %esi movq 0x8(%rdi), %rcx cmpq %rsi, %rdx je 0x707f3 vmovsd (%rax,%rsi,2), %xmm0 vmovsd %xmm0, (%rcx,%rsi) addq $0x8, %rsi jmp 0x707de movl %r14d, %esi callq 0x709aa leaq 0x30(%rsp), %rdi callq 0x70ad6 leaq 0x10(%rsp), %rdi callq 0x65830 addq $0x48, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq jmp 0x70829 movq %rax, %rbx jmp 0x70836 jmp 0x70829 jmp 0x70829 leaq 0x30(%rsp), %rdi movq %rax, %rbx callq 0x70ad6 leaq 0x10(%rsp), %rdi callq 0x65830 movq %rbx, %rdi callq 0xb3d0
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::itm::quadratic_cost_type<double>::make_l1_norm(int)
void make_l1_norm(int n) { Float div = { 0 }; for (int i = 0; i != n; ++i) div += std::abs(linear_elements[i]); for (int i = 0, e = indices[n]; i != e; ++i) div += std::abs(quadratic_elements[i].factor); if (std::isnormal(div)) { for (int i = 0; i != n; ++i) linear_elements[i] /= div; for (int i = 0, e = indices[n]; i != e; ++i) quadratic_elements[i].factor /= div; } }
vmovddup 0x3e7270(%rip), %xmm1 # xmm1 = mem[0,0] movq 0x8(%rdi), %rax vxorpd %xmm0, %xmm0, %xmm0 movl %esi, %ecx xorl %edx, %edx cmpq %rdx, %rcx je 0x70873 vmovsd (%rax,%rdx,8), %xmm2 incq %rdx vandpd %xmm1, %xmm2, %xmm2 vaddsd %xmm2, %xmm0, %xmm0 jmp 0x7085c movq 0x18(%rdi), %r8 movslq %esi, %rdx movq 0x10(%rdi), %rsi movl (%r8,%rdx,4), %edx xorl %r8d, %r8d shlq $0x4, %rdx cmpq %r8, %rdx je 0x708a2 vmovsd (%rsi,%r8), %xmm2 addq $0x10, %r8 vandpd %xmm1, %xmm2, %xmm2 vaddsd %xmm2, %xmm0, %xmm0 jmp 0x70889 vmovq %xmm0, %rsi movabsq $-0x10000000000000, %r8 # imm = 0xFFF0000000000000 btrq $0x3f, %rsi addq %rsi, %r8 shrq $0x35, %r8 cmpl $0x3fe, %r8d # imm = 0x3FE ja 0x708ff xorl %esi, %esi cmpq %rsi, %rcx je 0x708e0 vmovsd (%rax,%rsi,8), %xmm1 vdivsd %xmm0, %xmm1, %xmm1 vmovsd %xmm1, (%rax,%rsi,8) incq %rsi jmp 0x708c8 movq 0x10(%rdi), %rax xorl %ecx, %ecx cmpq %rcx, %rdx je 0x708ff vmovsd (%rax,%rcx), %xmm1 vdivsd %xmm0, %xmm1, %xmm1 vmovsd %xmm1, (%rax,%rcx) addq $0x10, %rcx jmp 0x708e6 retq
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::itm::quadratic_cost_type<double>::make_l2_norm(int)
void make_l2_norm(int n) { Float div = { 0 }; for (int i = 0; i != n; ++i) div += linear_elements[i] * linear_elements[i]; ; for (int i = 0, e = indices[n]; i != e; ++i) div += quadratic_elements[i].factor * quadratic_elements[i].factor; if (std::isnormal(div)) { for (int i = 0; i != n; ++i) linear_elements[i] /= div; for (int i = 0, e = indices[n]; i != e; ++i) quadratic_elements[i].factor /= div; } }
movq 0x8(%rdi), %rax vxorpd %xmm0, %xmm0, %xmm0 movl %esi, %ecx xorl %edx, %edx cmpq %rdx, %rcx je 0x70920 vmovsd (%rax,%rdx,8), %xmm1 incq %rdx vfmadd231sd %xmm1, %xmm1, %xmm0 # xmm0 = (xmm1 * xmm1) + xmm0 jmp 0x7090c movq 0x18(%rdi), %r8 movslq %esi, %rdx movq 0x10(%rdi), %rsi movl (%r8,%rdx,4), %edx xorl %r8d, %r8d shlq $0x4, %rdx cmpq %r8, %rdx je 0x7094c vmovsd (%rsi,%r8), %xmm1 addq $0x10, %r8 vfmadd231sd %xmm1, %xmm1, %xmm0 # xmm0 = (xmm1 * xmm1) + xmm0 jmp 0x70936 vmovq %xmm0, %rsi movabsq $-0x10000000000000, %r8 # imm = 0xFFF0000000000000 btrq $0x3f, %rsi addq %rsi, %r8 shrq $0x35, %r8 cmpl $0x3fe, %r8d # imm = 0x3FE ja 0x709a9 xorl %esi, %esi cmpq %rsi, %rcx je 0x7098a vmovsd (%rax,%rsi,8), %xmm1 vdivsd %xmm0, %xmm1, %xmm1 vmovsd %xmm1, (%rax,%rsi,8) incq %rsi jmp 0x70972 movq 0x10(%rdi), %rax xorl %ecx, %ecx cmpq %rcx, %rdx je 0x709a9 vmovsd (%rax,%rcx), %xmm1 vdivsd %xmm0, %xmm1, %xmm1 vmovsd %xmm1, (%rax,%rcx) addq $0x10, %rcx jmp 0x70990 retq
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::itm::quadratic_cost_type<double>::make_loo_norm(int)
void make_loo_norm(int n) { Float div = *std::max_element(linear_elements.get(), linear_elements.get() + n); for (int i = 0, e = indices[n]; i != e; ++i) div = std::max(quadratic_elements[i].factor, div); if (std::isnormal(div)) { for (int i = 0; i != n; ++i) linear_elements[i] /= div; for (int i = 0, e = indices[n]; i != e; ++i) quadratic_elements[i].factor /= div; } }
pushq %rbp pushq %r14 pushq %rbx movq %rdi, %rbx movq 0x8(%rdi), %rdi movslq %esi, %r14 movl %esi, %ebp leaq (%rdi,%r14,8), %rsi callq 0x66358 vmovsd (%rax), %xmm0 movq 0x18(%rbx), %rax movq 0x10(%rbx), %rcx xorl %edx, %edx movl (%rax,%r14,4), %eax shlq $0x4, %rax cmpq %rdx, %rax je 0x709e9 vmaxsd (%rcx,%rdx), %xmm0, %xmm0 addq $0x10, %rdx jmp 0x709d9 vmovq %xmm0, %rcx movabsq $-0x10000000000000, %rdx # imm = 0xFFF0000000000000 btrq $0x3f, %rcx addq %rcx, %rdx shrq $0x35, %rdx cmpl $0x3fe, %edx # imm = 0x3FE ja 0x70a4b movq 0x8(%rbx), %rcx movl %ebp, %edx xorl %esi, %esi cmpq %rsi, %rdx je 0x70a2c vmovsd (%rcx,%rsi,8), %xmm1 vdivsd %xmm0, %xmm1, %xmm1 vmovsd %xmm1, (%rcx,%rsi,8) incq %rsi jmp 0x70a14 movq 0x10(%rbx), %rcx xorl %edx, %edx cmpq %rdx, %rax je 0x70a4b vmovsd (%rcx,%rdx), %xmm1 vdivsd %xmm0, %xmm1, %xmm1 vmovsd %xmm1, (%rcx,%rdx) addq $0x10, %rdx jmp 0x70a32 popq %rbx popq %r14 popq %rbp retq
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::itm::quadratic_cost_type<double>::min(int) const
Float min(int n) const noexcept { Float min = std::numeric_limits<Float>::max(); for (int i = 0; i != n; ++i) if (linear_elements[i]) min = std::min(min, std::abs(linear_elements[i])); for (int i = 0, e = indices[n]; i != e; ++i) if (quadratic_elements[i].factor) min = std::min(min, std::abs(quadratic_elements[i].factor)); return min; }
vmovsd 0x3e2a4e(%rip), %xmm0 # 0x454008 vmovddup 0x3e64fe(%rip), %xmm1 # xmm1 = mem[0,0] movq 0x8(%rdi), %rax vxorpd %xmm2, %xmm2, %xmm2 movl %esi, %ecx xorl %edx, %edx cmpq %rdx, %rcx je 0x715f9 vmovsd (%rax,%rdx,8), %xmm3 incq %rdx vandpd %xmm1, %xmm3, %xmm4 vcmpneqpd %xmm2, %xmm3, %k1 vcmpltpd %xmm0, %xmm4, %k0 kandw %k0, %k1, %k1 vmovsd %xmm4, %xmm0, %xmm0 {%k1} jmp 0x715ce movq 0x18(%rdi), %rdx movslq %esi, %rcx movq 0x10(%rdi), %rax vxorpd %xmm2, %xmm2, %xmm2 movl (%rdx,%rcx,4), %ecx xorl %edx, %edx shlq $0x4, %rcx cmpq %rdx, %rcx je 0x7163d vmovsd (%rax,%rdx), %xmm3 addq $0x10, %rdx vandpd %xmm1, %xmm3, %xmm4 vcmpneqpd %xmm2, %xmm3, %k1 vcmpltpd %xmm0, %xmm4, %k0 kandw %k0, %k1, %k1 vmovsd %xmm4, %xmm0, %xmm0 {%k1} jmp 0x71611 retq
/quesnel[P]baryonyx/lib/src/itm-common.hpp
baryonyx::itm::best_solution_recorder<baryonyx::itm::quadratic_cost_type<double>, double, baryonyx::itm::maximize_tag>::mutation(baryonyx::itm::local_context&, baryonyx::bit_array&)
void mutation(local_context& ctx, bit_array& x) { if (ctx.value_p_dist.mean() == 0.0 && ctx.value_p_dist.stddev() == 0.0) return; double val_p, var_p; do var_p = ctx.variable_p_dist(ctx.rng); while (var_p <= 0.0 || var_p >= 1.0); do val_p = ctx.value_p_dist(ctx.rng); while (val_p < 0.0 || val_p > 1.0); to_log(stdout, 7u, "- mutation variables {}% with " " {}% of set\n", var_p, val_p); std::bernoulli_distribution dist_var_p(var_p); std::bernoulli_distribution dist_value_p(val_p); for (int i = 0, e = x.size(); i != e; ++i) { if (dist_var_p(ctx.rng)) { to_log(stdout, 9u, "- mutate variable {}\n", i); x.set(i, dist_value_p(ctx.rng)); } } }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x28, %rsp vmovsd 0x48(%rsi), %xmm0 vxorpd %xmm1, %xmm1, %xmm1 movq %rdx, %rbx movq %rsi, %r14 vucomisd %xmm1, %xmm0 jne 0x7174e jp 0x7174e vmovsd 0x50(%r14), %xmm0 vucomisd %xmm1, %xmm0 jne 0x7174e jp 0x7174e addq $0x28, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq leaq 0x48(%r14), %r15 leaq 0x28(%r14), %r12 movq %r12, %rdi movq %r14, %rsi callq 0x3c480 vxorpd %xmm1, %xmm1, %xmm1 vucomisd %xmm0, %xmm1 jae 0x71756 vucomisd 0x3e28c5(%rip), %xmm0 # 0x454038 jae 0x71756 vmovsd %xmm0, 0x18(%rsp) movq %r15, %rdi movq %r14, %rsi callq 0x3c480 vxorpd %xmm1, %xmm1, %xmm1 vucomisd %xmm0, %xmm1 ja 0x7177b vucomisd 0x3e28a0(%rip), %xmm0 # 0x454038 ja 0x7177b movq 0x5cb827(%rip), %rax # 0x63cfc8 leaq 0x20(%rsp), %r15 leaq 0x3e8c6f(%rip), %rcx # 0x45a41c vmovsd %xmm0, (%r15) movq (%rax), %rdi pushq $0x7 popq %rsi pushq $0x2a popq %rdx leaq 0x18(%rsp), %r12 movq %r15, %r9 movq %r12, %r8 callq 0x3c5d8 vmovsd (%r12), %xmm0 vmovsd (%r15), %xmm1 leaq 0x4(%rsp), %rax andl $0x0, (%rax) xorl %eax, %eax movl (%rbx), %r15d vmovsd %xmm0, 0x10(%rsp) vmovsd %xmm1, 0x8(%rsp) pushq $0x9 popq %rbp pushq $0x15 popq %r13 cmpl %r15d, %eax je 0x7173f movq %r14, %rdi callq 0x36ac3 vmovsd 0x10(%rsp), %xmm1 vucomisd %xmm0, %xmm1 jbe 0x7185a movq 0x5cb7ae(%rip), %rax # 0x63cfc8 leaq 0x3e8c26(%rip), %rcx # 0x45a447 leaq 0x4(%rsp), %r8 movl %ebp, %esi movq %r13, %rdx movq (%rax), %rdi callq 0x3c631 movl 0x4(%rsp), %r12d movq %r14, %rdi callq 0x36ac3 vmovsd 0x8(%rsp), %xmm1 xorl %edx, %edx movq %rbx, %rdi movl %r12d, %esi vucomisd %xmm0, %xmm1 seta %dl callq 0x3c67e movl 0x4(%rsp), %eax incl %eax movl %eax, 0x4(%rsp) jmp 0x717f6
/quesnel[P]baryonyx/lib/src/itm-optimizer-common.hpp