# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

# pcgcomp

Linear inequalities for asset group comparison constraints

As an alternative to `pcgcomp`, use the Portfolio object (`Portfolio`) for mean-variance portfolio optimization. This object supports gross or net portfolio returns as the return proxy, the variance of portfolio returns as the risk proxy, and a portfolio set that is any combination of the specified constraints to form a portfolio set. For information on the workflow when using Portfolio objects, see Portfolio Object Workflow.

## Syntax

```[A,b] = pcgcomp(GroupA,AtoBmin,AtoBmax,GroupB)
```

## Arguments

 `GroupA``GroupB` Number of groups (`NGROUPS`) by number of assets (`NASSETS`) specifications of groups to compare. Each row specifies a group. For a specific group, `Group(i,j) = 1` if the group contains asset `j`; otherwise, `Group(i,j) = 0`. `AtoBmin``AtoBmax` Scalar or `NGROUPS`-long vectors of minimum and maximum ratios of allocations in `GroupA` to allocations in `GroupB`. `NaN` indicates no constraint between the two groups. Scalar bounds are applied to all group pairs. The total number of assets allocated to `GroupA` divided by the total number of assets allocated to `GroupB` is >= `AtoBmin` and <= `AtoBmax`.

## Description

`[A,b] = pcgcomp(GroupA,AtoBmin,AtoBmax,GroupB)` specifies that the ratio of allocations in one group to allocations in another group is at least `AtoBmin` to `1` and at most `AtoBmax` to `1`. Comparisons can be made between an arbitrary number of group pairs `NGROUPS` comprising subsets of `NASSETS` available investments.

`A` is a matrix and `b` a vector such that `A*PortWts' <= b`, where `PortWts` is a `1`-by-`NASSETS` vector of asset allocations.

If `pcgcomp` is called with fewer than two output arguments, the function returns `A` concatenated with `b` `[A,b]`.

## Examples

 `Asset` INTC XOM RD `Region` North America North America Europe `Sector` Technology Energy Energy

Group

Min. Exposure

Max. Exposure

North America

0.30

0.75

Europe

0.10

0.55

Technology

0.20

0.50

Energy

0.20

0.80

Make the North American energy sector compose exactly 20% of the North American investment.

```% INTC XOM RD GroupA = [ 0 1 0 ]; % North American Energy GroupB = [ 1 1 0 ]; % North America AtoBmin = 0.20; AtoBmax = 0.20; [A,b] = pcgcomp(GroupA, AtoBmin, AtoBmax, GroupB)```
```A = 0.2000 -0.8000 0 -0.2000 0.8000 0 b = 0 0 ```

Portfolio weights of 40% for INTC, 10% for XOM, and 50% for RD satisfy the constraints.