cubic_parameters_model

(function from pyomo.contrib.cspline_external.cspline_parameters)

pyomo.contrib.cspline_external.cspline_parameters.cubic_parameters_model(x_data, y_data, x_knots=None, end_point_constraint=True, objective_form=False, name='cubic spline parameters model')[source]

Create a Pyomo model to calculate parameters for a cubic spline. By default this creates a square linear model, but optionally it can leave off the endpoint second derivative constraints and add an objective function for fitting data instead. The purpose of the alternative least squares form is to allow the spline to be constrained in other ways that don’t require a perfect data match. The knots don’t need to be the same as the x data to allow, for example, additional segments for extrapolation. This is not the most computationally efficient way to calculate parameters, but since it is used to precalculate parameters, speed is not important.

Parameters:
  • x_data – sorted list of x data

  • y_data – list of y data

  • x_knots – optional sorted list of knots (default is to use x_data)

  • end_point_constraint – if True add constraint that second derivative = 0 at endpoints (default=True)

  • objective_form – if True write a least squares objective rather than constraints to match data (default=False)

  • name – optional model name

Returns:

Pyomo ConcreteModel