FrankJ

28 Reputation

2 Badges

16 years, 245 days

MaplePrimes Activity


These are replies submitted by FrankJ

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?
Many thanks for your help.
Frank

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?
Many thanks for your help.
Frank

Page 1 of 1