0 1 Hi everyone, I have values as integer array x[i][j], y[i][j], p[i][j][e], u[j]. These values are obtained using a heuristic algorithm now, I want to pass these values to CPLEX as start solution using these values. I using addMIPStart() method for this. My approach is as: I definedIloNumVar2DArray Xcplex(env,T), Ycplex(env,T) IloNumVar3DArray Pcplex(env,T) IloNumVarArray Ucplex(env,K) and similarlyIloNumVar2DArray x_val(env,T), y_val(env,T) IloNumVar3DArray p_val(env,T) IloNumVarArray u_val(env,K) (and also defined memory for both of these arrays). Then I stored the values of x[i][j], y[i][j], p[i][j][e], u[j]in x_val(env), y_val(env), p_val(env), u_val(env) using loops. Now I am calling addMipStart as follows:IloNumVarArray XstartVar(env), YstartVar(env); IloNumArray XstartVal(env), YstartVal(env); for(int i=0;i

 4 Your post is too messy to understand what you've done. But, here is my two cents. The error "IloExtractable 100 IloNumVarl has not been extracted by by iloalgorithm" means that you've tried to access a variable array that is not initialized yet. Remember that just defining a variable in its environment does not initialize it. To initialize a variable array, you should define its size and variables type besides its environment. IloNumVarArray xVar(env, nbNodes, 0, 1, ILOINT);  Also, according to your code, you're trying to define a 2D variable array by just defining its environment. You have to define the size of its first dimension as well. IloNumVar2DArray yVar(env, nbNodes); for(i = 0; i < nbNodes; i++) yVar[i] = IloNumVarArray(env, yVar, 0, 1, ILOINT);  answered 20 Jun '13, 15:33 Ehsan ♦ 4.8k●3●11●22 accept rate: 16% Sorry for that massy code: But I have already defined 2D array with number rows now also it is giving problem is my addMipStart is correct or not (20 Jun '13, 16:36) mohitapm10 I think the problem is that you're defining the necessary variables to store the MIP Start values as IloNumVarArray, and not IloNumArray. See the CPLEX documentation for the correct example.  IloNumVarArray startVar(env); IloNumArray startVal(env); for (int i = 0; i < m; ++i) for (int j = 0; j < n; ++j) { startVar.add(x[i][j]); startVal.add(start[i][j]); } cplex.addMIPStart(startVar, startVal); startVal.end(); startVar.end();  (20 Jun '13, 17:24) Ehsan ♦ Yeah I modified that but still it is not working for the. for the one problem instance problem was occurred at 3D array. for another it gives problem for one 2D array and 3D array. When I commented out addMipStart() command for these code runs properly can you tell me what may be the problem. (21 Jun '13, 03:26) mohitapm10 @Ehsan thank you for the answers. I agree. Let me add that this kind of question can be asked on the CPLEX support forum. (21 Jun '13, 04:56) jfpuget @mohitapm10: It's hard to tell. Maybe since you're having problem with different instances, there is an error in dimensions of the data. In other words, perhaps you are trying to pass 2D or #D arrays smaller than the ones you've initialized. You should also try @jfpuget's suggestion. (21 Jun '13, 07:07) Ehsan ♦
 2 I assume that Xcplex ... Ucplex are the variables used in your IloModel. I suggest that you assign them names, so that (hopefully) the error message identifies the offending variable with something more helpful than "IloNumVar1". I'm not sure what happens if you attempt to assign a starting value to a variable that is not actually part of the problem being solved, but I wouldn't be surprised if the error message looked like the one you got. Remember that defining a variable w[i][j][k] does not guarantee that it appears in the extracted IloCplex object; it will only be extracted if it is used in either a constraint or the objective function. One note unrelated (I think) to the error message: I'm pretty sure you are using addMIPStart incorrectly. It is not cumulative, so by calling it multiple times you are actually trying to create multiple starting solutions. The first starting solution specifies values for the X variables and leaves it to CPLEX to find/guess values for the others. The second starting solution specifies values for the Y variables but leaves the other ones (including the X variables) for CPLEX to figure out, and so on. If you are trying to create one starting solution, cram all the variables into a single IloNumVarArray (and all their values into a single IloNumArray) and call addMIPStart once with those as arguments. answered 21 Jun '13, 10:51 Paul Rubin ♦♦ 14.6k●4●12 accept rate: 19% @Paul Rubin , Thanks for such a nice response. So you are saying that addMIPstart() can only be used once in the program. Ok, is this a correct code please check. IloNumVarArray startVar(env); IloNumArray startVal(env); for(int i=0;i
 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
×30