-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOptimizer.m
53 lines (43 loc) · 1.83 KB
/
Optimizer.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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
classdef Optimizer
%OPTIMIZER Perform optimizations.
% Class for performing optimizations of the dependency graph. At the
% moment the following optimizations are implemented:
% - Merging: Merge DCs together.
%
% Warning: It is not clear, if this class will still be used. Logical
% optimizations are to be done on a higher level, and by a separate
% project.
properties
end
methods
function [optimizer, graph] = Optimizer(graph)
%OPTIMIZER Optimize passed circuit.
graph = optimizer.optimize(graph);
end
function graph = optimize(optimizer, graph)
%OPTIMIZE Optimize graph
% Perform a multitute of optimizations on the passed
% dependency graph:
% - Merge DCs together
graph = optimizer.optimize_swap(graph);
graph = optimizer.optimize_merge(graph);
end
end
methods(Access = private)
function graph = optimize_merge(optimizer, graph)
%OPTIMIZE_MERGE Merge parts together
% Merge parts, that can be logically merge, together by
% adjusting their properties and removing the parts used
% during the merge.
% Merge DCs together. Change properties, based on merge.
end
function graph = optimize_swap(optimizer, graph)
%OPTIMIZE_SWAP TODO
% TODO
% TODO: It is possible that DCs have as waveguides with input (1, 0)
% and output (0, 1). This means, that a waveguide
% crossing needs to placed, in order to swap the
% waveguides. This should be handled in the Generator.
end
end
end