phase.py 1.5 KB
Newer Older
1
2
# -*- coding: utf-8 -*-

3
from proxtoolbox.Problems.problems import Problem
4
5
6
7
8
from proxtoolbox import Algorithms
from proxtoolbox import ProxOperators
from proxtoolbox.ProxOperators.proxoperators import ProxOperator


9
class Phase(Problem):
10
    """
11
    Phase Problem
12
13
14
15
16
17
    """
    config = {
    }
    
    def __init__(self, new_config={}):
        """
18
        The initialization of a Phase instance takes the default configuration
19
20
21
22
23
24
25
        and updates the parameters with the arguments in new_config.
        
        Parameters
        ----------
        new_config : dict, optional - Parameters to initialize the problem. If unspecified, the default config is used.
        """
        self.config.update(new_config)
26
27
        print(new_config['algorithm']);
        self.algorithm = getattr(Algorithms, self.config['algorithm'])(new_config)
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
        
    
    
    def _presolve(self):
        """
        Prepares argument for actual solving routine
        """
    
    
    def _solve(self):
        """
        Runs the algorithm to solve the given sudoku problem
        """
#        algorithm = self.config['algorithm'](self.config)
        
        self.u1,self.u2,self.iters,self.change,self.gap = \
            self.algorithm.run(self.u,self.config['tol'],self.config['maxiter'])
    
    
    def _postsolve(self):
        """
        Processes the solution and generates the output
        """
        
        
        
    def show(self):
        """
        Generates graphical output from the solution
        """