I know this is a long shot, but has anyone here had any experience using CPLEX?

I'm trying to code an ILP, but I'm having trouble with one of the constraints.

In plain english: A company is selling three products (which have other constraints as well) and they don't want any one product to account for more than 40% of the total products manufactured.

Mathematically:

sum( fraction( product[p] ) ) for all p = 1

fraction( product[p] ) <= 0.4

My problem is that I don't think this is a linear constraint, and I'm not sure how to make it one / define it in CPLEX.

This is the code I came up with, but it won't compile, though it does make sense mathematically:

Thanks for the help guys.

Edited by TEntel - 3/5/11 at 8:00pm

I'm trying to code an ILP, but I'm having trouble with one of the constraints.

In plain english: A company is selling three products (which have other constraints as well) and they don't want any one product to account for more than 40% of the total products manufactured.

Mathematically:

sum( fraction( product[p] ) ) for all p = 1

fraction( product[p] ) <= 0.4

My problem is that I don't think this is a linear constraint, and I'm not sure how to make it one / define it in CPLEX.

This is the code I came up with, but it won't compile, though it does make sense mathematically:

Code:

```
for (p = 0; p < numProducts; p++) {
IloExpr expr5(env);
IloExpr expr6(env);
for(q = 0; q < numProducts; q++){
expr6 += assign[q];
}
expr5 = assign[p];
model.add( ( expr5 / expr6 ) <= maxFraction);
expr5.end(); expr6.end();
}
```

Thanks for the help guys.

Edited by TEntel - 3/5/11 at 8:00pm