1 | # _________________________________________________________________________ |
---|
2 | # |
---|
3 | # Coopr: A COmmon Optimization Python Repository |
---|
4 | # Copyright (c) 2009 Sandia Corporation. |
---|
5 | # This software is distributed under the BSD License. |
---|
6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, |
---|
7 | # the U.S. Government retains certain rights in this software. |
---|
8 | # For more information, see the Coopr README.txt file. |
---|
9 | # _________________________________________________________________________ |
---|
10 | |
---|
11 | from pyutilib.component.core import * |
---|
12 | from coopr.pysp import phextension |
---|
13 | |
---|
14 | class examplephextension(SingletonPlugin): |
---|
15 | |
---|
16 | implements (phextension.IPHExtension) |
---|
17 | |
---|
18 | def post_instance_creation(self, ph): |
---|
19 | """ Called after PH initialization has created the scenario instances, but before any PH-related weights/variables/parameters/etc are defined!""" |
---|
20 | print "POST INSTANCE CREATION PH CALLBACK INVOKED" |
---|
21 | |
---|
22 | def post_ph_initialization(self, ph): |
---|
23 | """ Called after PH initialization!""" |
---|
24 | print "POST INITIALIZATION PH CALLBACK INVOKED" |
---|
25 | |
---|
26 | def post_iteration_0_solves(self, ph): |
---|
27 | """ Called after the iteration 0 solves!""" |
---|
28 | print "POST ITERATION 0 SOLVE PH CALLBACK INVOKED" |
---|
29 | |
---|
30 | def post_iteration_0(self, ph): |
---|
31 | """ Called after the iteration 0 solves, averages computation, and weight computation""" |
---|
32 | print "POST ITERATION 0 PH CALLBACK INVOKED" |
---|
33 | |
---|
34 | def pre_iteration_k_solves(self, ph): |
---|
35 | """ Called immediately before the iteration k solves!""" |
---|
36 | print "PRE ITERATION K SOLVE PH CALLBACK INVOKED" |
---|
37 | |
---|
38 | def post_iteration_k_solves(self, ph): |
---|
39 | """ Called after the iteration k solves!""" |
---|
40 | print "POST ITERATION K SOLVE PH CALLBACK INVOKED" |
---|
41 | |
---|
42 | def post_iteration_k(self, ph): |
---|
43 | """ Called after the iteration k is finished, after weights have been updated!""" |
---|
44 | print "POST ITERATION K PH CALLBACK INVOKED" |
---|
45 | |
---|
46 | def post_ph_execution(self, ph): |
---|
47 | """ Called after PH has terminated!""" |
---|
48 | print "POST EXECUTION PH CALLBACK INVOKED" |
---|
49 | |
---|
50 | |
---|
51 | |
---|