# Cplex range problem

 0 Hi, I have a problem of formulation of my mathematical model on CPLEX. My problem consists to read mutli scenarios. I have a parameter App[s][p][per]. Knowing that : indices: s means scenarios, p means patients, per means periods. The range of indice p depends on scenarios. My question: how can i declarate the range of indice p depending on scenarios and how can i declarate parameter App[s][p][per] on CPLEX?! Best regards asked 04 Jun '16, 05:22 lolla 11●2 accept rate: 0% When you say "parameter" do you mean a model coefficient or a variable? (Some people mistakenly use "parameter" when they mean "variable".) Also, when you say "on CPLEX" do you mean in the OPL language, or are you using one of the programming APIs (C++, Java, ...)? (04 Jun '16, 15:23) Paul Rubin ♦♦ Hi, It is not a variable. I'm using OPL language. (04 Jun '16, 15:40) lolla My sheet containts data like this example:  S1----------S2------ 1 2 3 4 5 6 1 2 3 4 =>(number of patients) Per1 1 0 0 0 0 0 1 1 0 0 Per2 0 1 0 0 0 0 0 0 1 0 Per3 0 0 1 1 1 0 0 0 0 0 Per4 0 0 0 0 0 1 0 0 0 1  S1 and S2 are scenarios. Number of patients changes from scenario to another (1 to 6 for scenario 1 || 1 to 4 for scenario 2) Per1 to Per4 are periods. How can i read data from my sheet?! (06 Jun '16, 05:45) lolla When supplying additional information or clarifications, please either edit your original question or use comments. You are posting "answers" that are actually questions. (06 Jun '16, 10:43) Paul Rubin ♦♦ Hi, then what you could do is use a first SheetRead to get the first line with S1, S2 ... and a second SheetRead to get the other lines. From that line, you will compute the values 6 and 4 (Number of patients per scenario) And then turn the 2D array into a tuple set as I described before. Regards (06 Jun '16, 11:52) AlexFleischer

 0 Hi, if "The range of indice p depends on scenarios.", then instead of an array like App[s][p][per] you should use a tuple structure: Let me give you an example: tuple app { key int s; key int p; key int per; int appvalue; }  and then you would define {app} Apps=...;  each scenario will have a different Apps.(That could be read from excel or a database) Regards answered 06 Jun '16, 03:18 AlexFleischer 86●3 accept rate: 10%
 toggle preview community wiki

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "Title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported

Tags:

×191
×127

Seen: 821 times

Last updated: 07 Jun '16, 09:55