--- Final Solver (used for performance test) ---
import numpy as np
import numba as nb
from typing import Any


@nb.njit(cache=True)
def _outer_nb(vec1, vec2):
    n1 = len(vec1)
    n2 = len(vec2)
    out = np.empty((n1, n2), dtype=np.float64)
    for i in range(n1):
        v = vec1[i]
        for j in range(n2):
            out[i, j] = v * vec2[j]
    return out


@nb.njit(cache=True)
def _outer_nb_i8(vec1, vec2):
    n1 = len(vec1)
    n2 = len(vec2)
    out = np.empty((n1, n2), dtype=np.int64)
    for i in range(n1):
        v = vec1[i]
        for j in range(n2):
            out[i, j] = v * vec2[j]
    return out


@nb.njit(cache=True)
def _outer_nb_i4(vec1, vec2):
    n1 = len(vec1)
    n2 = len(vec2)
    out = np.empty((n1, n2), dtype=np.int32)
    for i in range(n1):
        v = vec1[i]
        for j in range(n2):
            out[i, j] = v * vec2[j]
    return out


class Solver:
    def __init__(self):
        # Trigger JIT compilation (does not count toward runtime)
        _outer_nb(np.array([1.0, 2.0]), np.array([3.0, 4.0]))
        _outer_nb_i8(np.array([1, 2], dtype=np.int64), np.array([3, 4], dtype=np.int64))
        _outer_nb_i4(np.array([1, 2], dtype=np.int32), np.array([3, 4], dtype=np.int32))

    def solve(self, problem, **kwargs) -> Any:
        vec1, vec2 = problem
        v1 = np.asarray(vec1)
        v2 = np.asarray(vec2)

        if v1.dtype == np.float64 and v2.dtype == np.float64:
            return _outer_nb(v1, v2)
        elif v1.dtype == np.int64 and v2.dtype == np.int64:
            return _outer_nb_i8(v1, v2)
        elif v1.dtype == np.int32 and v2.dtype == np.int32:
            return _outer_nb_i4(v1, v2)
        else:
            v1 = v1.astype(np.float64, copy=False)
            v2 = v2.astype(np.float64, copy=False)
            return _outer_nb(v1, v2)
--- End Solver ---
Running performance test...
============================= test session starts ==============================
platform linux -- Python 3.12.13, pytest-9.0.2, pluggy-1.6.0
rootdir: /tests
plugins: anyio-4.13.0, jaxtyping-0.3.9
collected 3 items

../tests/test_outputs.py .
--- Performance Summary ---
Validity: True
Total Baseline Time: 6.5353s
Total Solver Time:   44.0706s
Raw Speedup:         0.1483 x
Final Reward (Score): 1.0000
---------------------------
.F

=================================== FAILURES ===================================
_____________________________ test_solver_speedup ______________________________

performance_results = {'raw_speedup': 0.14829170104695608, 'speedup': 1.0, 'validity': True}

    def test_solver_speedup(performance_results):
        """Checks if the solver effectively optimized the code."""
>       assert performance_results["raw_speedup"] > 1.0, \
            f"Solver was not faster than baseline (Speedup: {performance_results['raw_speedup']:.2f}x)"
E       AssertionError: Solver was not faster than baseline (Speedup: 0.15x)
E       assert 0.14829170104695608 > 1.0

/tests/test_outputs.py:205: AssertionError
==================================== PASSES ====================================
=========================== short test summary info ============================
PASSED ../tests/test_outputs.py::test_solver_exists
PASSED ../tests/test_outputs.py::test_solver_validity
FAILED ../tests/test_outputs.py::test_solver_speedup - AssertionError: Solver...
=================== 1 failed, 2 passed in 751.16s (0:12:31) ====================
