mailr19768 - in /trunk: pipe_control/minimise.py specific_analyses/api_base.py specific_analyses/setup.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on May 29, 2013 - 14:28:
Author: bugman
Date: Wed May 29 14:28:48 2013
New Revision: 19768

URL: http://svn.gna.org/viewcvs/relax?rev=19768&view=rev
Log:
Added the ability for specific analyses to override the optimisation 
constraint algorithm.

The default is still the 'Method of Multipliers', but if the 
constraint_algorithm() method returns
a different string, then that will be used to select the algorithm.  This 
allows the 'Log Barrier'
method in minfx to be used.


Modified:
    trunk/pipe_control/minimise.py
    trunk/specific_analyses/api_base.py
    trunk/specific_analyses/setup.py

Modified: trunk/pipe_control/minimise.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/minimise.py?rev=19768&r1=19767&r2=19768&view=diff
==============================================================================
--- trunk/pipe_control/minimise.py (original)
+++ trunk/pipe_control/minimise.py Wed May 29 14:28:48 2013
@@ -173,7 +173,10 @@
     # Re-package the minimisation algorithm, options, and constraints for 
the generic_minimise() calls within the specific code.
     if constraints:
         min_options = [min_algor]
-        min_algor = 'Method of Multipliers'
+
+        # Determine the constraint algorithm to use.
+        fn = specific_analyses.setup.get_specific_fn('constraint_algorithm', 
cdp.pipe_type)
+        min_algor = fn()
     else:
         min_options = []
     if line_search != None:

Modified: trunk/specific_analyses/api_base.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/api_base.py?rev=19768&r1=19767&r2=19768&view=diff
==============================================================================
--- trunk/specific_analyses/api_base.py (original)
+++ trunk/specific_analyses/api_base.py Wed May 29 14:28:48 2013
@@ -122,6 +122,23 @@
 
         # Not implemented.
         raise RelaxImplementError('calculate')
+
+
+    def constraint_algorithm(self):
+        """Return the optimisation constraint algorithm, defaulting to the 
Method of Multipliers.
+
+        This can return one of:
+
+            - 'Method of Multipliers',
+            - 'Log barrier'.
+
+
+        @return:    The constraint algorithm to use (one of 'Method of 
Multipliers' or 'Log barrier').
+        @rtype:     str
+        """
+
+        # The default.
+        return 'Method of Multipliers'
 
 
     def create_mc_data(self, data_id=None):

Modified: trunk/specific_analyses/setup.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/specific_analyses/setup.py?rev=19768&r1=19767&r2=19768&view=diff
==============================================================================
--- trunk/specific_analyses/setup.py (original)
+++ trunk/specific_analyses/setup.py Wed May 29 14:28:48 2013
@@ -80,6 +80,10 @@
         if eqi == 'calculate':
             function = inst.calculate
 
+        # Optimisation constraint algorithm override.
+        if eqi == 'constraint_algorithm':
+            function = inst.constraint_algorithm
+
         # Create Monte Carlo data function.
         if eqi == 'create_mc_data':
             function = inst.create_mc_data




Related Messages


Powered by MHonArc, Updated Wed May 29 15:00:02 2013