Class SOCPLinearSectorNeutrality

All Implemented Interfaces:
Function<Vector,Double>, RealScalarFunction

public class SOCPLinearSectorNeutrality extends SOCPPortfolioConstraint
A sector neutrality means that the sum of weights for given sectors are zero. \[ \sum_{j \in S_i} y_j = 0, \quad i = 1, \ldots, k \] where \(S_i\)'s represent the given \(k\) sectors.
  • Field Details

  • Constructor Details

    • SOCPLinearSectorNeutrality

      public SOCPLinearSectorNeutrality(Vector[] S)
      Creates a sector neutrality constraint.
      Parameters:
      S - the sector indicators; S[i].get(j) == 1 if asset \(j\) is in sector \(S_i\); 0 otherwise
    • SOCPLinearSectorNeutrality

      public SOCPLinearSectorNeutrality(Vector[] S, double epsilon)
      Creates a sector neutrality constraint.
      Parameters:
      S - the sector indicators; S[i].get(j) == 1 if asset \(j\) is in sector \(S_i\); 0 otherwise
      epsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0
  • Method Details

    • areAllConstraintsSatisfied

      public boolean areAllConstraintsSatisfied(Vector y) throws SOCPPortfolioConstraint.ConstraintViolationException
      Description copied from class: SOCPPortfolioConstraint
      Checks whether all SOCP constraints represented by this portfolio constraint are satisfied.
      Specified by:
      areAllConstraintsSatisfied in class SOCPPortfolioConstraint
      Parameters:
      y - a portfolio solution or allocation; the asset weights
      Returns:
      true if and only if all SOCP constraints are satisfied
      Throws:
      SOCPPortfolioConstraint.ConstraintViolationException
    • evaluate

      public Double evaluate(Vector y)
      Description copied from interface: Function
      Evaluate the function f at x, where x is from the domain.
      Parameters:
      y - x
      Returns:
      f(x)
    • 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.
      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.
      Returns:
      the dimension of the range