0

I am trying to put together an lp with the following situation.

I have 10 objects (O1-O10) that have 5 characteristics (C1-C5). I want to find a set of 3 of those objects with weights such that the total weight of each characteristic is Y.

Something like this: O1*C1+O1*C2+...+O1*C5 = Y . . . O5*C1+O5*C2+...+O5*C5 = Y

with only 3 O1-O10 greater than 0.

Is this possible?

1 Answers1

1

You need to be more precise. I'll try to make a first step. I assume we need to choose an integral number of each object say x(i). We only want 3 different objects. I.e.:

 0 <= x(i) <= MAXX * z(i)
 sum(i, z(i)) <= 3
 z(i) in {0,1} (binary variable)
 x(i) integer variable (make continuous if we can choose fractional values)

Here x(i) is the number of objects of type i chosen, and z(i)=0 or 1 indicates if we can choose objects of type i. This makes the problem no longer a continuous LP problem but rather a MIP.

The conditions O1*C1+O1*C2+...+O1*C5 = Y . . . O5*C1+O5*C2+...+O5*C5 = Y look very strange. In my notation that would be:

 x(i) * d(i) = z(i)*Y   for all i
 where d(i) = sum(j, c(i,j)) (constant)    

Don't know what the objective is.

Erwin Kalvelagen
  • 15,677
  • 2
  • 14
  • 39
  • Thanks for the response Erwin. Let me restate the question. I have 10 stocks. Each stock has exposure to 3 macroeconomic factors. I want to trade 3 of the 10 stocks and I want the resulting portfolio to have specific exposure to each factor. The objective is to minimize the difference between the resultant portfolio macroeconomic exposures and the ideal exposures (say 0, 0, 0 for example). The parameters to adjust are the 3 stock weights but also which 3 stocks to choose. One could apply a minimization to each combination of 3 stocks but as N gets large this becomes intractable. Clearer? – user3444632 Mar 10 '18 at 00:48
  • Surely a MIP model will be much more efficient than enumerating all solutions. A MIP solver will typically only consider a small fraction of all solutions while still being able to prove optimality. – Erwin Kalvelagen Mar 10 '18 at 00:53
  • Surely, however the MIP models I have found are all linear. I want to minimize this: `sum(x[i]*b[i]*f[i])-p` where x is a continuous variable, b is a binary variable, and f and p are constants. But MIPModel sees this is non-linear given that two variables are being multiplied. Do you see the problem? – user3444632 Mar 12 '18 at 00:38
  • MIQP and MINLP. models are used widely. Having said that, it is not at all clear to me that your problem leads to a nonlinear model. – Erwin Kalvelagen Mar 12 '18 at 00:46
  • Yea you're right it actually doesn't. I was able to formulate it and solve it using lpSolveAPI. Thanks a lot!! – user3444632 Mar 13 '18 at 13:35