j. smith

15 Reputation

2 Badges

20 years, 192 days

MaplePrimes Activity


These are replies submitted by

@Carl Love 

 

Thanks for your help. Who or when is the bug in NLPSolve going to be fixed?

 

Jim

@Carl Love 

Thank you so much. I grew up on Maple 9 and Maple 10 had the first Optimization routines and that is perhaps why I still use the old concepts. Again, you have been very helpful.

 

Regards,

Jim

@Carl Love 

 

You are correct. Thank you so much it works.

Jim

Here is another example and the computed answer is way off again. The inital vector is close to what the fortran program gave, but Maple is not corect.

A := Matrix([[1, -.5, -.5], [0, 1, -.8], [0, -.6, 1]]);

b := Vector([1, 0, 0]);


IterativeApproximate(`<|>`(A, b), initialapprox = Vector([1, 1.5, 1.7]), tolerance = 10^(-3), maxiterations = 20, stoppingcriterion = relative(infinity), method = gaussseidel);

Vector(3, {(1) = 1.000706385, (2) = 0.4238308055e-3, (3) = 0.2542984833e-3})

@Carl Love

 

But I don't think that is correct. I have a Fortran program that computes the solution as (1,1,1,1) so the (1,0,0,0) is not right. Basically, the input P  matrix shows that the relative arrival rates are about the same for each queue, so node 1 cannot dominate. 

Actually, when I entered b=([1,1,1,1]) it worked. Everything is ok.

@Carl Love 

 

I did what you suggested but I still get the wrong answer, not what you got which is correct

 

IterativeApproximate(`<|>`(A, b), initialapprox = Vector([1, 1, 1, 1]), tolerance = 10^(-3), maxiterations = 20, stoppingcriterion = relative(infinity), method = gaussseidel);

Vector(4, {(1) = 1.000428778, (2) = 0.2467490013e-3, (3) = 0.1892815477e-3, (4) = 0.1451981728e-3})

 

Maybe the way I entered <A|b> is not correct?

 

Sorry, I copied the wrong file. Actually, the query is the following:

 

restart;
with(Student[NumericalAnalysis]); with(LinearAlgebra);

A := Matrix([[1, -.333, -.333, -.333], [0, 1, -.333, -.333], [0, -.333, 1, -.333], [0, -.333, -.333, 1]]);

IsDefinite(A, 'query' = 'positive_semidefinite');
true


b := Vector([1, 0, 0, 0]);

IterativeApproximate(A, b, initialapprox = Vector([1, 1, 1, 1]), tolerance = 10^(-3), maxiterations = 20, stoppingcriterion = relative(infinity), method = gaussseidel);

Vector(4, {(1) = 1.000428778, (2) = 0.2467490013e-3, (3) = 0.1892815477e-3, (4) = 0.1451981728e-3})

 

but this is an incorrect answer. The initial solution is more correct.

 

Actually, I used the call statement below and it worked. I have the bounds and an inital point.

 

sol := Optimization-NLPSolve(f, {}, {proc (x1, x2, x3, x4) options operator, arrow; x1+x2+x3+x4-65 end proc}, 0 .. 20, 0 .. 10, 0 .. 20, 0 .. 15, initialpoint = [20, 10, 20, 15], assume = nonnegative)

 

sol := Optimization+[-4.51081257971916827, -(Vector(4, {(1) = 20., (2) = 10., (3) = 20., (4) = 15.}))]

 

I don't know why there are negtive signs but the positive numbers makes sense.

Thank you for all your help

Well I placed the variables x1,x2,x3,x4 without being a vector in the call to the procedure and removed the ranges and put in an initial point as follows just to give it a good starting solution:

 

sol := Optimization-NLPSolve(f, {}, {proc (x1, x2, x3, x4) options operator, arrow; x1+x2+x3+x4-65 end proc}, initialpoint = [20, 10, 20, 15])

 

Error, (in Optimization:-NLPSolve) input list has incorrect dimension

 

 

This also I don't understand the error

Thank you for your suggestion. I re-entered the problem as you suggested and now I get the message:

sol := Optimization-NLPSolve(f, {}, {proc (x1, x2, x3, x4) options operator, arrow; x1+x2+x3+x4-65 end proc}, 0 .. 20, 0 .. 10, 0 .. 20, 0 .. 15, minimize)

Error, (in Optimization:-NLPSolve) incorrect number of ranges

 

The bounds are as specified and appear correct but Maple does not like it.

Page 1 of 1