# Introduction to 2D Pareto Fronts

    set.seed(42)
    df <- data.frame(
      cost = runif(50, 10, 100),
      performance = runif(50, 0, 1)
    )

    head(df)
    #>       cost performance
    #> 1 92.33254  0.33342721
    #> 2 94.33679  0.34674825
    #> 3 35.75256  0.39848541
    #> 4 84.74029  0.78469278
    #> 5 67.75710  0.03893649
    #> 6 56.71864  0.74879539

    is_optimal <- pareto_2d(
      x = df$cost,
      y = df$performance,
      x_bigger_better = FALSE,
      y_bigger_better = TRUE
    )

    # How many optimal points did we find?
    sum(is_optimal)
    #> [1] 4

    result <- plot_pareto(
      df,
      x_col = "cost",
      y_col = "performance",
      x_bigger_better = FALSE,
      y_bigger_better = TRUE,
      show_all_points = TRUE
    )

    result$plot

Pareto Front showing Cost vs Performance trade-off.