Case Study: Portfolio Replication with Cardinality and Buyin Constraints

Back to main page

Case study background and problem formulations:
all PROBLEMS
PROBLEM 3 Dataset 4: inequality variant

Instructions for optimization with PSG Run-File, PSG MATLAB Toolbox, PSG MATLAB Subroutines and PSG R.

Sources of Data
PROBLEM 1: Index Tracking with Variable Transaction Costs
Minimize Max_Risk (minimizing the maximum absolute difference between tracking portfolio return and index return)
subject to
Cardn_pos <= Const1 (constraint on the number of assets in the new tracking portfolio)
Buyin_pos <= 0 (constraint prohibiting small value for chosen assets)
Linear + trcost = Const2 (balance: new tracking portfolio value + transaction cost = current tracking portfolio value)
Polynom_abs – trcost = 0 (constraint defines variable transaction costs)
Box constraints (bounds on variables)
——————————————————————–
Max_Risk = Maximum Risk for Loss
Cardn_pos = Cardinality Positive
Byin_pos = Buyin Positive
Polynom_abs = Polynomial Absolute Function, which is the weighted sum of absolute values
Box constraints = constraints on individual decision variables
——————————————————————–

Problem “problem_indtrack_max”

# of Variables # of Scenarios Objective Value Solving Time, PC 3.14GHz (sec)
Dataset1 32 145 0.041199 0.07
Environments
Run-File Problem Statement Data Solution
Matlab Toolbox Data
Matlab Subroutines Matlab Code Data
R R Code Data
Download other datasets in Run-File Environment.
Instructions for importing problems from Run-File to PSG MATLAB.

Problem Datasets # of Variables # of Scenarios Objective Value Solving Time (sec), PC 2.66GHz
Dataset2 ProblemStatement Data Solution 32 145 0.031839 0.09
Dataset3 ProblemStatement Data Solution 32 145 0.026542 0.12
Dataset4 ProblemStatement Data Solution 32 145 0.016964 0.06
Dataset5 ProblemStatement Data Solution 86 145 0.031624 1.87
Dataset6 ProblemStatement Data Solution 86 145 0.023680 0.95
Dataset7 ProblemStatement Data Solution 86 145 0.017439 0.68
Dataset8 ProblemStatement Data Solution 86 145 0.018381 0.50
Dataset9 ProblemStatement Data Solution 90 145 0.028519 0.75
Dataset10 ProblemStatement Data Solution 90 145 0.021581 0.71
Dataset11 ProblemStatement Data Solution 90 145 0.0193180 0.57
Dataset12 ProblemStatement Data Solution 90 145 0.017578 0.45
Dataset13 ProblemStatement Data Solution 99 145 0.042692 2.28
Dataset14 ProblemStatement Data Solution 99 145 0.021179 0.67
Dataset15 ProblemStatement Data Solution 99 145 0.019423 0.71
Dataset16 ProblemStatement Data Solution 99 145 0.019273 0.74
Dataset17 ProblemStatement Data Solution 226 145 0.0232216 9.45
Dataset18 ProblemStatement Data Solution 226 145 0.024168 12.66
Dataset19 ProblemStatement Data Solution 226 145 0.023965 17.00
Dataset20 ProblemStatement Data Solution 226 145 0.012819 10.0

PROBLEM 2: Index Tracking with Variable Transaction Costs

Data and solution in Run-File Environment

Minimize Meanabs (minimizing the the average of the absolute differences between tracking portfolio return and index return)
subject to
Cardn_pos <= Const1 (constraint on the number of assets in the new tracking portfolio)
Buyin_pos <= 0 (constraint prohibiting small value of chosen assets)
Linear + trcost = Const2 (balance: new tracking portfolio value + transaction cost = current tracking portfolio value)
Polynom_abs trcost = 0 (constraint defines variable transaction costs)
Box constraints (bounds on variables)
——————————————————————–
Meanabs = Mean Absolute Penalty
Cardn_pos = Cardinality Positive
Byin_pos = Buyin Positive
Polynom_abs = Polynomial Absolute Function, which is the weighted sum of absolute values
Box constraints = constraints on individual decision variables
——————————————————————–

Problem “problem_indtrack_avg”

# of Variables # of Scenarios Objective Value Solving Time, PC 3.14GHz (sec)
Dataset1 32 145 0.009719 0.05
Environments
Run-File Problem Statement Data Solution
Matlab Toolbox Data
Matlab Subroutines Matlab Code Data
R R Code Data
Download other datasets in Run-File Environment.
Instructions for importing problems from Run-File to PSG MATLAB.

Problem Datasets # of Variables # of Scenarios Objective Value Solving Time (sec), PC 2.66GHz
Dataset2 ProblemStatement Data Solution 32 145 0.009309 0.04
Dataset3 ProblemStatement Data Solution 32 145 0.006522 0.07
Dataset4 ProblemStatement Data Solution 32 145 0.004527 0.10
Dataset5 ProblemStatement Data Solution 86 145 0.011399 0.36
Dataset6 ProblemStatement Data Solution 86 145 0.009482 0.04
Dataset7 ProblemStatement Data Solution 86 145 0.007537 0.34
Dataset8 ProblemStatement Data Solution 86 145 0.005219 0.66
Dataset9 ProblemStatement Data Solution 90 145 0.008305 0.48
Dataset10 ProblemStatement Data Solution 90 145 0.007706 0.51
Dataset11 ProblemStatement Data Solution 90 145 0.006414 0.79
Dataset12 ProblemStatement Data Solution 90 145 0.005149 0.57
Dataset13 ProblemStatement Data Solution 99 145 0.008439 1.41
Dataset14 ProblemStatement Data Solution 99 145 0.007711 1.77
Dataset15 ProblemStatement Data Solution 99 145 0.006234 0.04
Dataset16 ProblemStatement Data Solution 99 145 0.005574 1.27
Dataset17 ProblemStatement Data Solution 226 145 0.006603 4.27
Dataset18 ProblemStatement Data Solution 226 145 0.005953 8.44
Dataset19 ProblemStatement Data Solution 226 145 0.005750 6.32
Dataset20 ProblemStatement Data Solution 226 145 0.005993 6.81

PROBLEM 3: Index Tracking with Variable and Fixed Transaction Costs
Minimize Max_Risk (minimizing the maximum absolute difference between tracking portfolio return and index return)
subject to
Cardn_pos <= Const1 (constraint on the number of assets in the new tracking portfolio)
Buyin_pos <= 0 (constraint prohibiting small value for chosen assets)
Linear + trcost = Const2 (balance: new tracking portfolio value + transaction cost = current tracking portfolio value)
Polynom_abs +Const3*(Cardn_pos+Cardn_neg) – trcost = 0 (constraint defines variable and fixed transaction costs)
Box constraints (bounds on variables)
——————————————————————–
Max_Risk = Maximum Risk for Loss
Cardn_pos = Cardinality Positive
Byin_pos = Buyin Positive
Polynom_abs = Polynomial Absolute Function, which is the weighted sum of absolute values
Box constraints = constraints on individual decision variables
——————————————————————–

Problem “problem_FC_indtrack_max”

# of Variables # of Scenarios Objective Value Solving Time, PC 3.14GHz (sec)
Dataset1 32 145 0.034463 0.23
Environments
Run-File Problem Statement Data Solution
Matlab Toolbox Data
Matlab Subroutines Matlab Code Data
R R Code Data
Download other datasets in Run-File Environment.
Instructions for importing problems from Run-File to PSG MATLAB.

Problem Datasets # of Variables # of Scenarios Objective Value Solving Time (sec), PC 2.66GHz
Dataset2 ProblemStatement Data Solution 32 145 0.028434 0.12
Dataset3 ProblemStatement Data Solution 32 145 0.025267 0.15
Dataset4 ProblemStatement Data Solution 32 145 0.019559 0.16
Dataset5 ProblemStatement Data Solution 86 145 0.038312 1.25
Dataset6 ProblemStatement Data Solution 86 145 0.029791 1.56
Dataset7 ProblemStatement Data Solution 86 145 0.020618 0.72
Dataset8 ProblemStatement Data Solution 86 145 0.020342 0.83
Dataset9 ProblemStatement Data Solution 90 145 0.030270 0.48
Dataset10 ProblemStatement Data Solution 90 145 0.029616 1.06
Dataset11 ProblemStatement Data Solution 90 145 0.029745 2.36
Dataset12 ProblemStatement Data Solution 90 145 0.016577 1.19
Dataset13 ProblemStatement Data Solution 99 145 0.041056 1.64
Dataset14 ProblemStatement Data Solution 99 145 0.030473 6.39
Dataset15 ProblemStatement Data Solution 99 145 0.023954 1.93
Dataset16 ProblemStatement Data Solution 99 145 0.022240 3.21
Dataset17 ProblemStatement Data Solution 226 145 0.025893 11.29
Dataset18 ProblemStatement Data Solution 226 145 0.017878 10.69
Dataset19 ProblemStatement Data Solution 226 145 0.017488 6.25
Dataset20 ProblemStatement Data Solution 226 145 0.018657 18.28

PROBLEM 4: Index Tracking with Variable and Fixed Transaction Costs
Minimize Meanabs (minimizing the average of the absolute differences between tracking portfolio return and index return)
subject to
Cardn_pos <= Const1 (constraint on the number of assets in the new tracking portfolio)
Buyin_pos <= 0 (constraint prohibiting small value for chosen assets)
Linear + trcost = Const2 (balance: new tracking portfolio value + transaction cost = current tracking portfolio value)
Polynom_abs + Const3*(Cardn_pos+Cardn_neg) – trcost = 0 (constraint defines variable and fixed transaction costs)
Box constraints (bounds on variables)
——————————————————————–
Max_Risk = Maximum Risk for Loss
Cardn_pos = Cardinality Positive
Byin_pos = Buyin Positive
Polynom_abs = Polynomial Absolute Function, which is the weighted sum of absolute values
Box constraints = constraints on individual decision variables
——————————————————————–

Problem “problem_FC_indtrack_avg”

# of Variables # of Scenarios Objective Value Solving Time, PC 3.14GHz (sec)
Dataset1 32 145 0.009981 0.07
Environments
Run-File Problem Statement Data Solution
Matlab Toolbox Data
Matlab Subroutines Matlab Code Data
R R Code Data
Download other datasets in Run-File Environment.
Instructions for importing problems from Run-File to PSG MATLAB.

Problem Datasets # of Variables # of Scenarios Objective Value Solving Time (sec), PC 2.66GHz
Dataset2 ProblemStatement Data Solution 32 145 0.009350 0.1
Dataset3 ProblemStatement Data Solution 32 145 0.008980 0.07
Dataset4 ProblemStatement Data Solution 32 145 0.005719 0.11
Dataset5 ProblemStatement Data Solution 86 145 0.012886 2.23
Dataset6 ProblemStatement Data Solution 86 145 0.009119 0.92
Dataset7 ProblemStatement Data Solution 86 145 0.006793 1.16
Dataset8 ProblemStatement Data Solution 86 145 0.006695 1.02
Dataset9 ProblemStatement Data Solution 90 145 0.009259 0.73
Dataset10 ProblemStatement Data Solution 90 145 0.008483 1.72
Dataset11 ProblemStatement Data Solution 90 145 0.007505 1.16
Dataset12 ProblemStatement Data Solution 90 145 0.007309 1.39
Dataset13 ProblemStatement Data Solution 99 145 0.009814 1.04
Dataset14 ProblemStatement Data Solution 99 145 0.006370 0.87
Dataset15 ProblemStatement Data Solution 99 145 0.005817 0.81
Dataset16 ProblemStatement Data Solution 99 145 0.005374 0.07
Dataset17 ProblemStatement Data Solution 226 145 0.006486 21.23
Dataset18 ProblemStatement Data Solution 226 145 0.006425 13.0
Dataset19 ProblemStatement Data Solution 226 145 0.005966 11.68
Dataset20 ProblemStatement Data Solution 226 145 0.005097 8.57
PROBLEM 5: Index Tracking with Variable and Fixed Transaction Costs
(Inequality formulation with PSG functions for PROBLEM 3 Dataset 4)

Minimize Max_Risk (minimizing the maximum absolute difference between tracking portfolio return and index return)
subject to
Cardn <= Const1 (constraint on the number of assets in the new tracking portfolio)
Buyin_pos <= 0 (constraint prohibiting small value for chosen assets)
Linear + trcost = Const2 (new tracking portfolio value + transaction cost <= current tracking portfolio value)
Const3*Polynom_abs + Const4*Cardn – trcost <= 0 (constraint defines variable and fixed transaction costs)
Box constraints (bounds on variables)
——————————————————————–
Max_Risk = Maximum Risk for Loss
Cardn = Cardinality
Byin_pos = Buyin Positive
Polynom_abs = Polynomial Absolute Function, which is the weighted sum of absolute values
Box constraints = constraints on individual decision variables
——————————————————————–

Problem “problem_fc_indtrack1_max_0100_convex”

# of Variables # of Scenarios Objective Value Solving Time, PC 3.14GHz (sec)
Dataset 32 145 0.01065 0.34
Environments
Run-File Problem Statement Data Solution
Matlab Toolbox Data
Matlab Subroutines Matlab Code Data
R R Code Data

PROBLEM 5a: Index Tracking with Variable and Fixed Transaction Costs
(MIP formulation with PSG functions for PROBLEM 3 Dataset 4)

Minimize Max_Risk (minimizing the maximum absolute difference between tracking portfolio return and index return)
subject to
Linear <= Const1 (constraint on the number of assets in the new tracking portfolio)
Linearmulti <= 0 (value of assets depends on choice of assets)
Linear + Const3*Linear_pol + Const4*Linear_cdn <= Const2 (new tracking portfolio value + variable transaction cost + fixed transaction cost <= current tracking portfolio value)
Const3*Linear_pol + Const4*Linear_cdn <= Const5 (constraint limits sum of variable and fixed transaction costs)
Linearmulti <= Vector_x0 (constraint defines absolute changes of assets)
Linearmulti <= 0 (constraint defines a number of changed assets)
Box constraints (bounds on variables)
Types of variables (defines which variables are boolean)
——————————————————————–
Max_Risk = Maximum Risk for Loss
Linear = Linear
Linearmulti = Linearmulti
Box constraints = constraints on individual decision variables
——————————————————————–

Problem “problem_fc_indtrack1_max_0100_MIP”

Data and solution in Run-File Environment
Problem Datasets # of Variables # of Scenarios Objective Value Solving Time (sec), PC 2.66GHz
Dataset1 ProblemStatement Data Solution 124 145 0.011586 7.0
Data (MPS file) and solution in Gurobi
Problem Datasets # of Variables # of Scenarios Objective Value Solving Time (sec), PC 2.66GHz
Dataset1 MPS Data Solution 124 145 0.010519 2.0

 

CASE STUDY SUMMARY
All PROBLEMS
Index tracking is a form of portfolio management that attempts to mirror the performance of a specific index and generate returns that are equal to those of the index, but without purchasing all of the stocks that make up the index. Such strategies involve building an investment portfolio designed to track a particular benchmark index.
The problem of finding new tracking portfolio is formulated here as: rebalance a portfolio in such way that number of assets in the new portfolio does not exceed a given number, positions for chosen assets are not small, sum of new portfolio value and transaction cost is equal to the current portfolio value, transaction costs may contain variable and fixed parts and are limited. Variable and fixed transactions costs are defined by asset positions changing. The objective is the maximum absolute difference between tracking portfolio return and index return or the average of the absolute differences between tracking portfolio return and index return.
Continues variables of the problem are values of assets. Portfolio Safeguard (PSG) has not used Boolean variables for solving this problem. The functions cardn_pos and buyin_pos address discontinuous performance of the objective function. To calculate the transaction cost polynom_abs, cardn_pos and cardn_neg PSG functions are used with asset values as variables.
A number of papers relating to index tracking have been discussed in Canakgoz and Beasley 2009 and Beasley et al. 2003. The case study solves a set of instances based on data files from OR-library (Basley 1990) and parameters considered in Beasley et al. 2003 and Canakgoz et al. 2009. The case study presents 80 instances: five data files form OR-library: indtrack1, indtrack2, …, indtarck 5; four limits for transaction cost; two variants of objective; two variants of transaction cost. The problem statements and the setting of the experiments closely follow the paper by Mezali and Beasley (2012). However the problem statements were formulated with PSG nonlinear functions without discrete variables (which leads to a simple programming of optimization problems).
 
PROBLEM 3 Dataset 4: inequality variant
In an inequality variant of the problem a sum of new portfolio value and transaction cost may be equal to or less than the current portfolio value.
Two formulations for such variant of the problem are considered above (PROBLEM 5 and PROBLEM 5a).
The first one is a standard formulation using Portfolio Safeguard (PSG) functions. In standard formulation PSG has not used Boolean variables for solving this problem.
The second one is a formulation of the problem as a Mixed Integer Problem (MIP). Such formulation uses linearization of Max_Risk function and additional continue and Boolean variables.
Two methods for solving the problem in MIP formulation are used.
The first one is using PSG solver. PSG calculates a lower bound for the optimal solution and used heuristic procedure to find good feasible solution.
The second one is passing the whole problem into the Gurobi solver and getting an optimal solution.
Three datasets for an inequality variant of the problem are used. All these variants generated on base of Dataset 4 for PROBLEM 3.
Third dataset is a MPS file passing the data into Gurobi solver.

 

References
• Beasley J E (1990). OR-Library: distributing test problems by electronic mail, Journal of the Operational Research Society, 41(11): 1069–1072. ( http://people.brunel.ac.uk/∼mastjjb/jeb/info.html)
• Beasley J E, Meade N and Chang T-J (2003). An evolutionary heuristic for the index tracking problem, European Journal of Operational Research, 148(3), 621–643.
• Canakgoz N A and Beasley J E (2009). Mixed-integer programming approaches for index tracking and enhanced indexation, European Journal of Operational Research, 196(1), 384-399.
• Mezali, H. and Beasley, J.E. (2012). Index Tracking with Fixed and Variable Transaction Costs. Optimization Letters. Submitted for publication.