Problem with a constraint

Problems with modeling
Post Reply
RZoro95
User
User
Posts: 11
Joined: 2 years ago

Problem with a constraint

Post by RZoro95 »

GAMS.PNG
Hi everyone, I have a problem with placing a constraint in a portfolio optimization problem. In practice I will explain the model: I have a set i of assets and a set s of sectors, the variable x (s, i) represents the quantity of assets i belonging to sector s. Then I have a parameter matrix (s, i) which represents a score, so it would be the score of the asset i belonging to sector s (I am attaching photos to show you how matrix (s, i) is made). Then I also have yields rend (s, i). In practice, in my model I want to maximize the total return of the portfolio and as constraints I have a constraint on the total sum of x (s, i) which must be equal to 1, a constraint on sector diversification (i.e. I want to have at least 1 asset per sector in my portfolio) and a constraint that only considers those assets with scores greater than or equal to 1. Unfortunately it is this last constraint that gives me problems, that is gams gives me an error. In particular it gives me the following error: it tells me that "equation infeasible due to the rhs value", could someone tell me why? and how could I go about solving? This is the model:


Variables
z objective function;

binary variables

y(s,i) asset i of the sector s is included in the portfolio or not;
positive variables
x(s,i);
equations
Objective
Constraint 1
Constraint 2(s,i)
Constraint3 (s);

Constraint1.. sum(s,sum(i,x(s,i))) =e= 1;
Objective.. z =e= sum(s, sum(i,matrix(s,i)*x(s,i)));
Constraint2(s,i).. matrix(s,i) =g= 1;
Constraint3.. sum(i,y(s,i)) =g= 1;
Post Reply