The OptimProblem types of problem is somewhat difficult to set up and is inconvient to use for most of the cases. A $C^0$ is a continiouse function, a $C^1$ function is a smooth function, but a $C^2$ function is a function that is continuous, smooth and has second derivative. It is also called a twice differentiable function.

				
// An example multivariate function.
val f: RealScalarFunction = object : AbstractBivariateRealFunction() {
override fun evaluate(x: Double, y: Double): Double {
return x * x - 4 * x + y * y - y - x * y
}
}

// construct an optimization problem
val problem: C2OptimProblem = C2OptimProblemImpl(f)

// Optimizes a multivariate function using Nelder-Mead's method.
1e-15, // epsilon
20) // max number of iterations