# CPLEX C++ Error while extracting values

 1 Hi i have a piece of code which has confused me alot i define my variables and values as following: IloNumArray val_x(env,N*N*(W+1)); IloBoolVarArray var_fpb_x(env,N*N*(W+1));  after solving the model i extract the values by: cout << endl << cpx_fpb.getObjValue() << endl; cpx_fpb.getValues(val_x,var_fpb_x);  but when I execute the binary file made by VC++, I get the following error exactly after it printed my problem's objective value: Concert exception caught:IloExtractable 9 IloNumVarI has not been extracted by IloAlgorithm  I don't know why this happens, I did not have this problem on other problems. asked 26 Oct '11, 04:04 Al1ta 23●2●7 accept rate: 0% fbahr ♦ 4.6k●7●16

 1 From the info you posted I believe you have an empty handle in your var_fpb_x that you are trying to access with the getValues call. You don't have to, and should not, specify the size on the val_x array. so this should work IloNumArray val_x(env); cpx_fpb.getValues(val_x,var_fpb_x);  If it doesn't , your error is probably elsewhere in the code. Do you get the right Objective value? answered 26 Oct '11, 04:20 Buxley 564●1●6●14 accept rate: 9% Still for clarification... Are you sure that you have the var_fpb_x variables in the model? The Error you are having basically comes from that you are asking for the value of variables that you don't use in the model. (There can be other reasons as well) You can write the model to a file with cpx_fpb.exportModel("filename.lp"); (26 Oct '11, 05:29) Buxley dear Buxley the problem still remains even when i declare IloNumvarArray , i solve the LP file with the stand alone solver of CPLEX which gives me the same results and if i want i can export variables from it (although variable values are not quite boolean as in 0 ,1 it contains 2.12e-17 instead of 0 or some negative tiny values do you think this is causing the problem? (26 Oct '11, 08:13) Al1ta 1 What I meant was are you sure you have NN(W+1) variables in your model. try not to declare the size of your BoolArray either. By writing IloBoolVarArray var_fpb_x(env); From the info you posted I believe you have an empty handle in your var_fpb_x that you are trying to access with the getValues call. The numerical values should not be the problem. (26 Oct '11, 08:22) Buxley dear Buxley , you were right , my problem has 3 index X(i,j,k) for (i!=j) since i ignored Xes with i=j in my model that error happened , i defined a constraint to make them zero and the code works fine now , thank you (26 Oct '11, 08:47) Al1ta
 toggle preview community wiki

### Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

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
×2
×2

Asked: 26 Oct '11, 04:04

Seen: 7,103 times

Last updated: 14 Jan '14, 09:45

### Related questions

OR-Exchange! Your site for questions, answers, and announcements about operations research.