Topic
3 replies Latest Post - ‏2013-01-17T06:58:52Z by SystemAdmin
Robop
Robop
8 Posts
ACCEPTED ANSWER

Pinned topic How to restart the model with different data?

‏2013-01-16T16:59:09Z |
Hi all!
I try to figure out how can I implement the following use-case:
Imagine, I have a simple model(just to explain). Smth like:

int a http://1..2 = 2,2;
int d http://1..2 = ...;
dvar int+ x1;
dvar int+ x2;

minimize x1+x2;
subject to{
a[1]*x1>=d[1];
a[2]*x2>=d[2];
}

And now I want to test my model for randomly generated data d has the same value all the time.
What is the easiest way to do that? Looks like the simple use-case, but I stuck here...

Actually, I generate the data in MATLAB, may I somehow implement the described above case using API for example? My real model is huge and I cannot easily find the needed data piece in the A matrix.

Thank you in advance for the help!

Attachments

Updated on 2013-01-17T06:58:52Z at 2013-01-17T06:58:52Z by SystemAdmin
  • Eumpfenbach
    Eumpfenbach
    198 Posts
    ACCEPTED ANSWER

    Re: How to restart the model with different data?

    ‏2013-01-16T22:03:11Z  in response to Robop
    There are a bunch of ways to do this, but the easiest one might be a script in Matlab that calls ILOG using the oplrun command.

    Something like:

    • Generate the parameters

    • Write a .Dat file

    • Move the .Dat file into the OPL folder (use the "dos" command in Matlab)

    • Execute the model (use the oplrun command)

    Repeat

    Use Google and the IlOG manual for the syntaxes. If something isn't clear, let me know.
  • Eumpfenbach
    Eumpfenbach
    198 Posts
    ACCEPTED ANSWER

    Re: How to restart the model with different data?

    ‏2013-01-16T22:11:42Z  in response to Robop
    Your other post specifically mentioned .lp files. Another way to do this is to use ILOG to get a single .lp file, then use the Matlab API.

    The API will create a cplex object "my_model" (you give the name, that is just an example), with the A matrix stored in my_model.A.

    You can change it with simple matlab commands like my_model.A(4,10) = 1.32. Then resolve.

    As for your model being huge and not being able to find what you need in the A matrix, are you searching using matlab or you just can't find it with your eyes? Use Matlab tools like find, min, max, or whatever else you need. But if you can't find what you need in the A matrix, Cplex / ILOG can't do that for you. It just solves what you give it. You have to manage the problem somehow.
  • SystemAdmin
    SystemAdmin
    7929 Posts
    ACCEPTED ANSWER

    Re: How to restart the model with different data?

    ‏2013-01-17T06:58:52Z  in response to Robop
    Is this the same as this question?