About accuracy of Fmincon
    5 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Dat Tran
 am 27 Jan. 2015
  
    
    
    
    
    Kommentiert: Dat Tran
 am 27 Jan. 2015
            Dear all,
I have used Fmincon to solve an constrained optimization and the Fmincon gives me two different solutions with two different computers while I used the same code and Matlab version (R2014a).
I am wondering what causes the problem?
Thank you! Dat
0 Kommentare
Akzeptierte Antwort
  John D'Errico
      
      
 am 27 Jan. 2015
        If I had a dollar for every time this (or a very similar) question is asked, well, I'd not be wealthy, but hey, every dollar counts!
While fmincon is a deterministic algorithm, there are MANY things that can cause differences.
 - Did you use the same starting values? Too often people use random starting values, maybe not even realizing they did so. So are your starting values the same? Down to the least significant bit? You would be surprised how easy this is to mistake.
 - Is your objective truly the same? Again, this is trivially easy to screw up. Perhaps there is data that was migrated from one system to the other? Too often people think they can simply copy what they see in the command window, or write a set of numbers out into an ascii file. Sorry, but that will not give you exactly the same result.
 - Is your objective function deterministic? There are some functions that seem deterministic, but are not so. For example, eigs or svds use random starting values. So if you call them in your code, don't expect identical results each time.
 - Is your code truly the same? Again, different systems may have different code. Perhaps you have a different objective function on the different systems and do not even realize this fact. Or some function that you wrote that is called may be different. People forget that they have some minor function that is different on the different system, but it happens to be crucial. YES, IT HAPPENS.
This was just a partial list of the things I've seen people get wrong over the years. Any one of them could be what you have done, or perhaps you got creative and found some different way.
You can try setting the random seed before each test, but even then there might be codes that reset the random seed themselves, perhaps based on time of day.
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

