## 28 Reputation

11 years, 337 days

## Thank you very much....

Thank you very much.

## I solved the problem....

I solved the problem.

try
B:=GlobalSolve(Z, a=0..2, b=0..2, c=0..2):
solutionvector:=matrix(1,3):
solutionvector:=[eval(a,B[2]),eval(b,B[2]),eval(c,B[2])]:
catch:
B:=GetLastSolution():
solutionvector:=matrix(1,3):
solutionvector:=[eval(B[2,1]),eval(B[2,2]),eval(B[2,3])];
end try;

Thank you very much.

## Hallo Axel, I changed the...

Hallo Axel,

I changed the code to:

for i from  1 to 100 do
data(i):= "read data from external file":
Z:= "function to optimize based on data(i)":
with(GlobalOptimization):
infolevel(GlobalOptimization):=4
try
B:=GlobalSolve(Z, a=0..2, b=0..2, c=0..2, timelimit=6000):
catch:
B:=GetLastSolution();
end try;

solutionvector:=matrix(1,3) #vector containing calculated values for 3 variables)
solutionvector:=[eval(a,B[2]),eval(b,B[2]),eval(c,B[2])];

end do:

But now I can no longer evaluate the solution vector (which made no problems before adding the try-sequence). The error code is:

Error, invalid input: eval expects its 2nd argument to be of type (iteger, equation, set(equation)), but recieved B[2].
Obviously the catch-procedure does not return values in the same format as before.  Do you have any idea how I can solve this?
Frank

## Hallo acer, n = 11, but...

Hallo acer,

n = 11, but Import only imported 10 rows, instead of 11. I changed the code to:

Import(Name[r],"Sheet0","A1:K1500")

and now it works fine.

Thank you very much for your help.

 Page 1 of 1
﻿