# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.optimization.multivariate.constrained.convex.sdp.socp.problem.portfoliooptimization

## Class SOCPPortfolioObjectiveFunction

• java.lang.Object
• com.numericalmethod.suanshu.optimization.multivariate.constrained.convex.sdp.socp.problem.portfoliooptimization.SOCPPortfolioObjectiveFunction
• All Implemented Interfaces:
Function<Vector,Double>, RealScalarFunction

public class SOCPPortfolioObjectiveFunction
extends Object
implements RealScalarFunction
Constructs the objective function for portfolio optimization. The general form is: $b'z = -\bar{r}^{\top}(w^0+x)+\lambda_r t_1+\lambda_c t_2$ , where $$t_{1}\in\mathbb{R}^{1}$$ and $$t_{2}\in\mathbb{R}^{1}$$ are usually the portfolio risk and market impact terms respectively. $$\bar{r}$$ is the expected portfolio return.

By letting $$y=x+w^{0}$$, the objective function becomes: $-\bar{r}^{\top}y+\lambda_rt_1+\lambda_ct_2$

• ### Nested classes/interfaces inherited from interface com.numericalmethod.suanshu.analysis.function.Function

Function.EvaluationException
• ### Constructor Summary

Constructors
Constructor and Description
SOCPPortfolioObjectiveFunction(Matrix returns, double[] lambda, SOCPRiskConstraint risk, SOCPPortfolioConstraint impact)
Constructs the objective function for an SOCP portfolio optimization (minimization) problem.
SOCPPortfolioObjectiveFunction(Matrix returns, double lambda, SOCPRiskConstraint risk)
Constructs the objective function for an SOCP portfolio optimization (minimization) problem without a market impact term.
SOCPPortfolioObjectiveFunction(Vector r_bar, double[] lambda, SOCPRiskConstraint risk, SOCPPortfolioConstraint impact)
Constructs the objective function for an SOCP portfolio optimization (minimization) problem.
SOCPPortfolioObjectiveFunction(Vector r_bar, double lambda, SOCPRiskConstraint risk)
Constructs the objective function for an SOCP portfolio optimization (minimization) problem without a market impact term.
• ### Method Summary

All Methods
Modifier and Type Method and Description
Vector b()
Gets the objective vector, b, in the compact form.
int dimensionOfDomain()
Get the number of variables the function has.
int dimensionOfRange()
Get the dimension of the range space of the function.
Double evaluate(Vector y)
Computes the final objective function value.
List<SOCPPortfolioConstraint> getPortfolioConstraints()
Gets the portfolio constraints represented in the objective function.
List<SOCPPortfolioConstraint.Variable> getVariables()
Gets the variables involved in the portfolio constraints implied by the objective function.
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Constructor Detail

• #### SOCPPortfolioObjectiveFunction

public SOCPPortfolioObjectiveFunction(Matrix returns,
double[] lambda,
SOCPRiskConstraint risk,
SOCPPortfolioConstraint impact)
Constructs the objective function for an SOCP portfolio optimization (minimization) problem.
Parameters:
returns - the return matrix
lambda - the coefficients of the portfolio risk and market impact terms
risk - the portfolio risk term
impact - the market impact term
• #### SOCPPortfolioObjectiveFunction

public SOCPPortfolioObjectiveFunction(Vector r_bar,
double[] lambda,
SOCPRiskConstraint risk,
SOCPPortfolioConstraint impact)
Constructs the objective function for an SOCP portfolio optimization (minimization) problem.
Parameters:
r_bar - the vector of average returns
lambda - the coefficients of the portfolio risk and market impact terms
risk - the portfolio risk term
impact - the market impact term
• #### SOCPPortfolioObjectiveFunction

public SOCPPortfolioObjectiveFunction(Matrix returns,
double lambda,
SOCPRiskConstraint risk)
Constructs the objective function for an SOCP portfolio optimization (minimization) problem without a market impact term.
Parameters:
returns - the return matrix
lambda - the coefficients of the portfolio risk terms
risk - the portfolio risk term
• #### SOCPPortfolioObjectiveFunction

public SOCPPortfolioObjectiveFunction(Vector r_bar,
double lambda,
SOCPRiskConstraint risk)
Constructs the objective function for an SOCP portfolio optimization (minimization) problem without a market impact term.
Parameters:
r_bar - the vector of average returns
lambda - the coefficients of the portfolio risk terms
risk - the portfolio risk term
• ### Method Detail

• #### getVariables

public List<SOCPPortfolioConstraint.Variable> getVariables()
Gets the variables involved in the portfolio constraints implied by the objective function.
Returns:
the variables involved in the portfolio constraints implied by the objective function
• #### getPortfolioConstraints

public List<SOCPPortfolioConstraint> getPortfolioConstraints()
Gets the portfolio constraints represented in the objective function.
Returns:
the portfolio constraints represented in the objective function
• #### b

public Vector b()
Gets the objective vector, b, in the compact form.
Returns:
the objective vector, b
• #### evaluate

public Double evaluate(Vector y)
Computes the final objective function value.
Specified by:
evaluate in interface Function<Vector,Double>
Parameters:
y - the positions
Returns:
the objective values
• #### dimensionOfDomain

public int dimensionOfDomain()
Description copied from interface: Function
Get the number of variables the function has. For example, for a univariate function, the domain dimension is 1; for a bivariate function, the domain dimension is 2.
Specified by:
dimensionOfDomain in interface Function<Vector,Double>
Returns:
the number of variables
• #### dimensionOfRange

public int dimensionOfRange()
Description copied from interface: Function
Get the dimension of the range space of the function. For example, for a Rn->Rm function, the dimension of the range is m.
Specified by:
dimensionOfRange in interface Function<Vector,Double>
Returns:
the dimension of the range