forum.alglib.net

ALGLIB forum
It is currently Mon Dec 23, 2024 4:53 am

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Problem with sparse solver
PostPosted: Fri Nov 16, 2012 3:47 am 
Offline

Joined: Sun May 16, 2010 11:42 pm
Posts: 63
I have been experimenting with using the sparse solver to analyse structural frames. Results have been generally good, with the solution of a 750x750 matrix coming down from about 2 minutes using a VBA Gaussian Elimination routine to about 0.05 seconds with the C# version of the sparse solver (2500 times faster!).

I'm having trouble with a very simple problem used to find the buckling load of straight columns. The column is subdivided into a number of segmemts, and given very small lateral deflections at each node, and adjusted iteratively until the deflected shape matches the bending moment diagram. With 8 segments the sparse solver gives results that are about 60% too small, and returns termination type 7. With 50 segments it takes several seconds to solve, and the results are also wrong, and with 100 segments it fails to converge after several minutes.

I have several questions:
1) Is this behaviour expected with the sparse solver with some problems?
2) If so, is there a way to monitor the solution and switch to a different solver if it is not converging?
3) Or is there something wrong with the way I have set the problem up (although the RMatrixSolve routine solves it with no problem)?
4) Any other suggestions?

For the buckling problem I will use one of the "dense" solvers, but I am concerned that this sort of behaviour may arise with other problems.

I have attached a spreadsheet with an example, including sparse solver solution and the RMatrixSolve results (starting line 32 on the "Solve" sheet).


Attachments:
Matrixdll-c#-sparse solver example.xlsb [907.78 KiB]
Downloaded 546 times

_________________
Doug Jenkins
http://newtonexcelbach.wordpress.com/
Top
 Profile  
 
 Post subject: Re: Problem with sparse solver
PostPosted: Fri Nov 16, 2012 7:42 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
Hello!

You have very badly conditioned problem - your 8-segment task has condition number about 10^9. CG solver stops either after discovering that problem is ill-conditioned (or after performing a lot of useless iterations).

Good news are that most of the ill-conditioning comes from bad scaling of your system. Simple diagonal scaling reduces condition number down to 1000 (or less). Modification of CG seems to be very easy (less than hour of development, several hours of testing). I will prepare fix and send it to you for evaluation today or maybe at Monday. It would be good to hear results on all problems: 8-segment, 50-segment, 100-segment.

P.S. thanks for your report of spam attack - I was out of office for several days, and noticed it only today.


Top
 Profile  
 
 Post subject: Re: Problem with sparse solver
PostPosted: Fri Nov 16, 2012 8:35 am 
Offline

Joined: Sun May 16, 2010 11:42 pm
Posts: 63
I'm impressed with the service! :)

I was also impressed with speed increase with the sparse solver. I got about a 50X improvement going from the VBA to the C# dense solver, and about another 50x with the sparse solver. That's with a 1170x1170 matrix.

_________________
Doug Jenkins
http://newtonexcelbach.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Problem with sparse solver
PostPosted: Mon Nov 19, 2012 11:10 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
here are the results :) Archive includes source code of modified ALGLIB (development version, but these modifications will be included in the next release) and precompiled DLL (NET assembly).

Can you replace your alglibnet2.dll with precompiled version from archive and report results on your problems?


Top
 Profile  
 
 Post subject: Re: Problem with sparse solver
PostPosted: Tue Nov 20, 2012 5:37 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
Ooops :) I've forgot to attach files....


Attachments:
File comment: ALGLIB - development version
alglib-dev.csharp.zip [1 MiB]
Downloaded 544 times
Top
 Profile  
 
 Post subject: Re: Problem with sparse solver
PostPosted: Tue Nov 20, 2012 5:47 am 
Offline

Joined: Sun May 16, 2010 11:42 pm
Posts: 63
Thanks - I won't have much time over the next few days, but I will report back as soon as I can.

_________________
Doug Jenkins
http://newtonexcelbach.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Problem with sparse solver
PostPosted: Sat Nov 24, 2012 12:35 am 
Offline

Joined: Sun May 16, 2010 11:42 pm
Posts: 63
I have now completed a reveiw of the new sparse solver and detailed results, comments and background information are in the attached file (Buckling analysis summary.xlsx). The main findings were:

Sparse solver results
Results with the new alglibnet2.dll file are much better than the previous version; however:
With Load factor = 100: accuracy compared with the dense solver reduces significantly for 8 segments, and is much worse for 16 segments or more.
Results with load factor = 10000 and 1E6 are better, but solution time is very slow for 50 segments
Results with load factor = 1E8 are very inaccurate, although convergence is reported; presumably the accuracy of the sparse solver is of the same order as the relative deflection between nodes.
Solution times where convergence is not achieved is very variable, with a maximum of almost 3 minutes.

For this application it seems that the dense solvers are more appropriate, since the analysis is sensitive to very small differences in calculated deflection, and the matrix sizes are not very big anyway, but it does seem to be a good problem to test the limits of the sparse solver. My main concern with the results at the moment is that the solution time is sometimes so long before it reports back non-convergence.

I have also attached the Excel file i am using to perform the analysis, and associated .dll and .tlb files.

Please let me know if you would like me to look at any other options for the comparative analyses.


Attachments:
Frame4buckle-dll-test sparse.zip [187.67 KiB]
Downloaded 512 times
Buckling analysis summary.xlsx [15.47 KiB]
Downloaded 596 times

_________________
Doug Jenkins
http://newtonexcelbach.wordpress.com/
Top
 Profile  
 
 Post subject: Re: Problem with sparse solver
PostPosted: Wed Jan 23, 2013 10:55 am 
Offline

Joined: Sun May 16, 2010 11:42 pm
Posts: 63
Preliminary tests with the new release (3.7) show much better performance with the sparse solver. With the buckling analysis reported in the previous post it is now successfully converging with up to 200 segments without loss of accuracy.

_________________
Doug Jenkins
http://newtonexcelbach.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Problem with sparse solver
PostPosted: Mon Jan 28, 2013 8:57 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
It is good to hear. Thanks again for your previous report, it led to very important improvements in the CG solver.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group