Line |
Branch |
Decision |
Exec |
Source |
1 |
|
|
|
// Copyright 2019-2022 Cambridge Quantum Computing |
2 |
|
|
|
// |
3 |
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License"); |
4 |
|
|
|
// you may not use this file except in compliance with the License. |
5 |
|
|
|
// You may obtain a copy of the License at |
6 |
|
|
|
// |
7 |
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0 |
8 |
|
|
|
// |
9 |
|
|
|
// Unless required by applicable law or agreed to in writing, software |
10 |
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS, |
11 |
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 |
|
|
|
// See the License for the specific language governing permissions and |
13 |
|
|
|
// limitations under the License. |
14 |
|
|
|
|
15 |
|
|
|
#pragma once |
16 |
|
|
|
|
17 |
|
|
|
#include "Mapping/RoutingMethod.hpp" |
18 |
|
|
|
|
19 |
|
|
|
namespace tket { |
20 |
|
|
|
|
21 |
|
|
|
class RoutingMethodCircuit : public RoutingMethod { |
22 |
|
|
|
public: |
23 |
|
|
✗ |
virtual ~RoutingMethodCircuit() {} |
24 |
|
|
|
/** |
25 |
|
|
|
* RoutingMethodCircuit objects hold methods for partially routing subcircuits |
26 |
|
|
|
* in the incremental routing of full circuits. |
27 |
|
|
|
* |
28 |
|
|
|
* @param _route_subcircuit Function ptr for partial routing method |
29 |
|
|
|
* @param _max_size Max number of gates in partial routing circuit |
30 |
|
|
|
* @param _max_depth Max depth of partial routing circuit |
31 |
|
|
|
*/ |
32 |
|
|
|
RoutingMethodCircuit( |
33 |
|
|
|
const std::function<std::tuple<bool, Circuit, unit_map_t, unit_map_t>( |
34 |
|
|
|
const Circuit&, const ArchitecturePtr&)> |
35 |
|
|
|
_route_subcircuit, |
36 |
|
|
|
unsigned _max_size, unsigned _max_depth); |
37 |
|
|
|
|
38 |
|
|
|
/** |
39 |
|
|
|
* @param mapping_frontier Contains boundary of routed/unrouted circuit for |
40 |
|
|
|
* modifying |
41 |
|
|
|
* @param architecture Architecture providing physical constraints |
42 |
|
|
|
* @return Logical to Physical mapping at boundary due to modification. |
43 |
|
|
|
* |
44 |
|
|
|
*/ |
45 |
|
|
|
std::pair<bool, unit_map_t> routing_method( |
46 |
|
|
|
MappingFrontier_ptr& mapping_frontier, |
47 |
|
|
|
const ArchitecturePtr& architecture) const; |
48 |
|
|
|
|
49 |
|
|
|
private: |
50 |
|
|
|
const std::function<std::tuple<bool, Circuit, unit_map_t, unit_map_t>( |
51 |
|
|
|
const Circuit&, const ArchitecturePtr&)> |
52 |
|
|
|
route_subcircuit_; |
53 |
|
|
|
unsigned max_size_, max_depth_; |
54 |
|
|
|
}; |
55 |
|
|
|
|
56 |
|
|
|
JSON_DECL(RoutingMethod); |
57 |
|
|
|
|
58 |
|
|
|
} // namespace tket |
59 |
|
|
|
|