0

I'm trying to model a student assignment probelm using cplex. I have student details in a access database (ex: student id and marks) I was able to obtain these values from db to .mod file using tuples.

tuple stuType{
  int id;
  int mark;
}

stuType m[id][mark]=...;

Now i want to use these values in my objective function.

maximize sum(a in id, b in id, k in mark) m [a] [k] * m [b] [k];

but this notation gives me errors in objective function. Any help on how to solve this problem is highly appreciated.

Pete
  • 57,112
  • 28
  • 117
  • 166
Ann
  • 403
  • 2
  • 5
  • 17

1 Answers1

0

Oh. Ok. Welcome to the wonderful world of optimisation. If you are new to programming in any form, then this could be a bit tricky; but it really isn't too complicated once you have a few basic ideas sorted. We'll just have to explain things a bit differently. I'd start with a really trivial model that does nothing much, but will at least let you look at your data.

Try using something really simple after your data reading stuff like:

dvar float+ x;
maximize x;
subject to
{
  x <= 10;
};

That model really has nothing to do with your data or your problem, but should at least run and the CPLEX studio environment should at least let you look at the data that it has read. Once you know what your data actually looks like, you stand a better chance of getting a model that does something useful.

TimChippingtonDerrick
  • 2,042
  • 1
  • 12
  • 13