Exemplo n.º 1
0
def create_optimization_result_nan_inf():
    """
    Create a result object containing nan and inf function values
    """
    # get result with only numbers
    result = create_optimization_result()

    # append nan and inf
    optimizer_result = optimize.OptimizerResult(
        fval=float('nan'), x=np.array([float('nan'),
                                       float('nan')]))
    result.optimize_result.append(optimizer_result=optimizer_result)
    optimizer_result = optimize.OptimizerResult(
        fval=-float('inf'), x=np.array([-float('inf'), -float('inf')]))
    result.optimize_result.append(optimizer_result=optimizer_result)

    return result
Exemplo n.º 2
0
def create_optimization_result():
    # create the pypesto problem
    problem = create_problem()

    # write some dummy results for optimization
    result = pypesto.Result(problem=problem)
    for j in range(0, 3):
        optimizer_result = optimize.OptimizerResult(id=str(j),
                                                    fval=j * 0.01,
                                                    x=np.array(
                                                        [j + 0.1, j + 1]))
        result.optimize_result.append(optimizer_result=optimizer_result)
    for j in range(0, 4):
        optimizer_result = optimize.OptimizerResult(
            id=str(j + 3),
            fval=10 + j * 0.01,
            x=np.array([2.5 + j + 0.1, 2 + j + 1]))
        result.optimize_result.append(optimizer_result=optimizer_result)

    return result