mailr10152 - in /branches/multi_processor_merge/specific_fns/model_free: mf_minimise.py multi_processor_commands.py


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

Header


Content

Posted by edward on January 07, 2010 - 18:44:
Author: bugman
Date: Thu Jan  7 18:44:20 2010
New Revision: 10152

URL: http://svn.gna.org/viewcvs/relax?rev=10152&view=rev
Log:
A number of changes for the MF_grid_command class.

process_results() has been absorbed into run(), the data required for the 
grid search is passed into
the class upon initialisation, and the call to minfx.generic_minimise() has 
been switched to a call
to minfx.grid() to correspond to the minfx library changes.


Modified:
    branches/multi_processor_merge/specific_fns/model_free/mf_minimise.py
    
branches/multi_processor_merge/specific_fns/model_free/multi_processor_commands.py

Modified: 
branches/multi_processor_merge/specific_fns/model_free/mf_minimise.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/multi_processor_merge/specific_fns/model_free/mf_minimise.py?rev=10152&r1=10151&r2=10152&view=diff
==============================================================================
--- branches/multi_processor_merge/specific_fns/model_free/mf_minimise.py 
(original)
+++ branches/multi_processor_merge/specific_fns/model_free/mf_minimise.py Thu 
Jan  7 18:44:20 2010
@@ -1627,15 +1627,15 @@
             # Normal grid search.
             if search('^[Gg]rid', min_algor):
                 # Minimisation initialisation.
-                command = MF_grid_command()
+                command = MF_grid_command(self.mf, inc=inc, lower=lower, 
upper=upper, A=A, b=b, verbosity=verbosity)
 
             # Minimisation of all other model types.
             else:
                 # Minimisation initialisation.
                 command = MF_minimise_command()
 
-            # Set up for optimisation.
-            command.set_minimise(mf=self.mf, model_type=model_type, args=(), 
x0=param_vector, min_algor=min_algor, min_options=min_options, 
func_tol=func_tol, grad_tol=grad_tol, maxiter=max_iterations, A=A, b=b, 
spin_id=spin_id, sim_index=sim_index, full_output=True, print_flag=verbosity)
+                # Set up for optimisation.
+                command.set_minimise(mf=self.mf, model_type=model_type, 
args=(), x0=param_vector, min_algor=min_algor, min_options=min_options, 
func_tol=func_tol, grad_tol=grad_tol, maxiter=max_iterations, A=A, b=b, 
spin_id=spin_id, sim_index=sim_index, full_output=True, print_flag=verbosity)
 
             # Set up the model-free memo and add it to the processor queue.
             memo = MF_memo(model_free=self, spin=spin, sim_index=sim_index, 
model_type=model_type, scaling=scaling, scaling_matrix=scaling_matrix)

Modified: 
branches/multi_processor_merge/specific_fns/model_free/multi_processor_commands.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/multi_processor_merge/specific_fns/model_free/multi_processor_commands.py?rev=10152&r1=10151&r2=10152&view=diff
==============================================================================
--- 
branches/multi_processor_merge/specific_fns/model_free/multi_processor_commands.py
 (original)
+++ 
branches/multi_processor_merge/specific_fns/model_free/multi_processor_commands.py
 Thu Jan  7 18:44:20 2010
@@ -245,17 +245,20 @@
 class MF_grid_command(MF_minimise_command):
     """Command class for the model-free grid search."""
 
-    def __init__(self):
-        """Execute the MF_minimise_command __init__() method."""
+    def __init__(self, mf, inc=None, lower=None, upper=None, A=None, b=None, 
verbosity=0):
+        """Execute the MF_minimise_command __init__() method and store all 
the data."""
 
         # Execute the base class __init__() method.
         super(MF_grid_command, self).__init__()
 
-
-    def process_results(self, results, processor, completed):
-        param_vector, func, iter, fc, gc, hc, warning = results
-
-        processor.return_object(MF_grid_result_command(processor, 
result_string, self.memo_id, param_vector, func, iter, fc, gc, hc, warning, 
completed=completed))
+        # Store the data.
+        self.mf = mf
+        self.inc = inc
+        self.lower = lower
+        self.upper = upper
+        self.A = A
+        self.b = b
+        self.verbosity = verbosity
 
 
     def run(self, processor, completed):
@@ -263,11 +266,17 @@
 
         # Run catching all errors.
         try:
-            # Minimisation.
-            results = generic_minimise(func=self.mf.func, 
dfunc=self.mf.dfunc, d2func=self.mf.d2func, **self.minimise_map)
+            # Grid search.
+            results = grid(func=self.mf.func, args=(), num_incs=self.inc, 
lower=self.lower, upper=self.upper, A=self.A, b=self.b, 
verbosity=self.verbosity)
+
+            # Unpack the results.
+            param_vector, func, iter, warning = results
+            fc = iter
+            gc = 0.0
+            hc = 0.0
 
             # Processing.
-            self.process_results(results, processor, completed)
+            processor.return_object(MF_result_command(processor, 
self.memo_id, param_vector, func, iter, fc, gc, hc, warning, 
completed=completed))
 
         # An error occurred.
         except Exception, e :




Related Messages


Powered by MHonArc, Updated Thu Jan 07 19:00:02 2010