LeastSquaresProblem¶
- class LeastSquaresProblem(*args)¶
Least-squares problem.
This represents a least-squares problem:
where f is the residual function.
- Parameters
- residualFunction
Function
Residual function.
- residualFunction
Examples
>>> import openturns as ot >>> residualFunction = ot.SymbolicFunction(['x0', 'x1'], ['10*(x1-x0^2)', '0.5-x0', '0.3-2*x1']) >>> problem = ot.LeastSquaresProblem(residualFunction)
Methods
Accessor to bounds.
Accessor to the object's name.
Accessor to input dimension.
Accessor to equality constraints.
getId
()Accessor to the object's id.
Accessor to inequality constraints.
Accessor to level function.
Accessor to level value.
getName
()Accessor to the object's name.
Accessor to objective function.
Accessor to level function.
Accessor to the object's shadowed id.
Accessor to the variables type.
Accessor to the object's visibility state.
Test whether bounds had been specified.
Test whether equality constraints had been specified.
Test whether inequality constraints had been specified.
Test whether level function had been specified.
Test whether objective function is a scalar or vector function.
hasName
()Test if the object is named.
Test whether a least-square problem is defined.
Test if the object has a distinguishable name.
Check if the problem is continuous.
Test whether this is a minimization or maximization problem.
setBounds
(bounds)Accessor to bounds.
setEqualityConstraint
(equalityConstraint)Accessor to equality constraints.
setInequalityConstraint
(inequalityConstraint)Accessor to inequality constraints.
setLevelFunction
(levelFunction)Accessor to level function.
setLevelValue
(levelValue)Accessor to level value.
setMinimization
(minimization)Tell whether this is a minimization or maximization problem.
setName
(name)Accessor to the object's name.
setObjective
(objective)Accessor to objective function.
setResidualFunction
(residualFunction)Accessor to level function.
setShadowedId
(id)Accessor to the object's shadowed id.
setVariablesType
(variableType)Accessor to the variables type.
setVisibility
(visible)Accessor to the object's visibility state.
- __init__(*args)¶
- getClassName()¶
Accessor to the object’s name.
- Returns
- class_namestr
The object class name (object.__class__.__name__).
- getDimension()¶
Accessor to input dimension.
- Returns
- dimensionint
Input dimension of objective function.
- getEqualityConstraint()¶
Accessor to equality constraints.
- Returns
- equality
Function
Describe equality constraints.
- equality
- getId()¶
Accessor to the object’s id.
- Returns
- idint
Internal unique identifier.
- getInequalityConstraint()¶
Accessor to inequality constraints.
- Returns
- inequality
Function
Describe inequality constraints.
- inequality
- getLevelValue()¶
Accessor to level value.
- Returns
- valuefloat
Level value.
- getName()¶
Accessor to the object’s name.
- Returns
- namestr
The name of the object.
- getShadowedId()¶
Accessor to the object’s shadowed id.
- Returns
- idint
Internal unique identifier.
- getVariablesType()¶
Accessor to the variables type.
- Returns
- variablesType
Indices
Types of the variables.
- variablesType
Notes
Possible values for each variable are ot.OptimizationProblemImplementation.CONTINUOUS, ot.OptimizationProblemImplementation.INTEGER and ot.OptimizationProblemImplementation.`BINARY`.
- getVisibility()¶
Accessor to the object’s visibility state.
- Returns
- visiblebool
Visibility flag.
- hasBounds()¶
Test whether bounds had been specified.
- Returns
- valuebool
True if bounds had been set for this problem, False otherwise.
- hasEqualityConstraint()¶
Test whether equality constraints had been specified.
- Returns
- valuebool
True if equality constraints had been set for this problem, False otherwise.
- hasInequalityConstraint()¶
Test whether inequality constraints had been specified.
- Returns
- valuebool
True if inequality constraints had been set for this problem, False otherwise.
- hasLevelFunction()¶
Test whether level function had been specified.
- Returns
- valuebool
True if level function had been set for this problem, False otherwise.
- hasMultipleObjective()¶
Test whether objective function is a scalar or vector function.
- Returns
- valuebool
False if objective function is scalar, True otherwise.
- hasName()¶
Test if the object is named.
- Returns
- hasNamebool
True if the name is not empty.
- hasResidualFunction()¶
Test whether a least-square problem is defined.
- Returns
- valuebool
True if this is a least-squares problem, False otherwise.
- hasVisibleName()¶
Test if the object has a distinguishable name.
- Returns
- hasVisibleNamebool
True if the name is not empty and not the default one.
- isContinuous()¶
Check if the problem is continuous.
- Returns
- isContinuousbool
Returns True if all variables are continuous.
- isMinimization()¶
Test whether this is a minimization or maximization problem.
- Returns
- valuebool
True if this is a minimization problem (default), False otherwise.
- setEqualityConstraint(equalityConstraint)¶
Accessor to equality constraints.
- Parameters
- equalityConstraint
Function
Equality constraints.
- equalityConstraint
- setInequalityConstraint(inequalityConstraint)¶
Accessor to inequality constraints.
- Parameters
- inequalityConstraint
Function
Inequality constraints.
- inequalityConstraint
- setLevelFunction(levelFunction)¶
Accessor to level function.
- Parameters
- levelFunction
Function
Level function.
- levelFunction
- setLevelValue(levelValue)¶
Accessor to level value.
- Parameters
- levelValuefloat
Level value.
- setMinimization(minimization)¶
Tell whether this is a minimization or maximization problem.
- Parameters
- minimizationbool
True if this is a minimization problem, False otherwise.
- setName(name)¶
Accessor to the object’s name.
- Parameters
- namestr
The name of the object.
- setObjective(objective)¶
Accessor to objective function.
- Parameters
- objectiveFunction
Function
Objective function.
- objectiveFunction
Notes
Constraints and bounds are cleared if the objective has a different input dimension in order to keep the problem valid at all time.
- setResidualFunction(residualFunction)¶
Accessor to level function.
- Parameters
- levelFunction
Function
Level function.
- levelFunction
- setShadowedId(id)¶
Accessor to the object’s shadowed id.
- Parameters
- idint
Internal unique identifier.
- setVariablesType(variableType)¶
Accessor to the variables type.
- Parameters
- variablesType
Indices
Types of the variables.
- variablesType
Notes
Possible values for each variable are ot.OptimizationProblemImplementation.CONTINUOUS, ot.OptimizationProblemImplementation.INTEGER and ot.OptimizationProblemImplementation.BINARY.
- setVisibility(visible)¶
Accessor to the object’s visibility state.
- Parameters
- visiblebool
Visibility flag.